Python 基础知识:乘法表

Python 基础知识:乘法表

乘法表从 0 到 15。
Python 代码:-
#multiplication table from 0 to 15
 print(" ",end="")
 for i in range(16):
 print("%5d|"%i, end="")

print()
 print("______" * 17)

for i in range(16):
 print("%5d|"%i, end="")

for j in range(16):
 print("%5d|"%(i*j), end="")

print()

输出 :-
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_37270421/article/details/133255867
今日推荐