码迷,mamicode.com
首页 > 其他好文 > 详细

优化版九九乘法表

时间:2018-09-02 18:49:23      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:color   int()   style   col   表示   乘法表   code   format   i+1   

# for 循环实现九九乘法表
for i in range(1, 10):    # 控制九九乘法表的行数
  for j in range(1, i+1):    # 控制九九乘法表的列数
    print("{}*{}={}".format(j, i, j*i), end="\t")  # {}表示空位,而.format()是去填补那些空位!
  print()  # 换行
  

 

优化版九九乘法表

标签:color   int()   style   col   表示   乘法表   code   format   i+1   

原文地址:https://www.cnblogs.com/uncle-kay/p/9574403.html

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