Properly formatted multiplication table

前端 未结 5 1511
青春惊慌失措
青春惊慌失措 2021-02-15 11:11

How would I make a multiplication table that\'s organized into a neat table? My current code is:

n=int(input(\'Please enter a positive integer between 1 and 15:          


        
5条回答
  •  灰色年华
    2021-02-15 11:30

    this one looks pretty neat:

       print '\t\t\t======================================='
       print("\t\t\t\tMultiplication Tables")
       print '\t\t\t=======================================\n'
       for i in range(1,11):
           print '\t', i,
       print
       print("___________________________________________________________________________________________________________________")
    
       for j in range(1,11):
           print("\n")
           print j, '|',
           for k in range(1,11):
               print '\t', j * k,
       print("\n")
    

提交回复
热议问题