网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

如何用Python写九九乘法表while循环for循环

时间:2024-10-12 04:03:43

1、方法一:for循环

2、打开pycharm,输入代码。for i in range(1,10): for m in range(1,i+1): print(f"{足毂忍珩i} * {m} = {i*m}",end=" ") print('')

如何用Python写九九乘法表while循环for循环

3、运行一下即可实现。

如何用Python写九九乘法表while循环for循环

4、方法二:while循环

5、输入代码i = 1while i < 10: m = 1 嘛术铹砾while m <= i: print(f"{足毂忍珩i} * {m} = {i*m}",end=" ") m+=1 print("") i+=1

如何用Python写九九乘法表while循环for循环

6、运行一下即可实现。

如何用Python写九九乘法表while循环for循环
© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com