#!/usr/bin/env python
# !_*_ coding:utf-8 _*_

"""
@version: python2.7
@license: Apache Licence 
@contact: longzinziyan@gmail.com
@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 ''
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐