1. 程式人生 > >python實現乘法表

python實現乘法表

#!/usr/bin/env python
# !_*_ coding:utf-8 _*_
"""
@version: python2.7
@license: Apache Licence 
@contact: [email protected]
@site: http://blog.csdn.net/dielian520
@time: 18-2-7 下午6:21
"""
i = 1
while i <= 9:
    j = 1
while j <= i:
        print '%d * %d = %-2d' % (j, i, i * j),
        if i != j:
            print 
' ', j += 1 print '' i += 1 for i in range(1, 10): for j in range(1, i + 1): print '%d * %d = %-2d' % (j, i, i * j), if i != j: print ' ', print ''