码迷,mamicode.com
首页 > 编程语言 > 详细

Python写99乘法表

时间:2016-05-19 13:07:39      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/bin/python
# -*- encoding:utf-8 -*-

for i in range(1,10):
    s=‘‘
    for j in range(1,i+1):
        s+="%d*%d=%d\t"%(i,j,i*j) #这是比较关键一步,如果不这样,就会成为全部竖着的,而不是一个三角形
    print s

Python写99乘法表

标签:

原文地址:http://www.cnblogs.com/miranda-tang/p/5508199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!