打印1~20之间整数的方法:
1、使用for循环
for i in range(1,21): print(i,end=',')
输出结果
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
2、使用while循环
i= 1 while i <= 20: print(i,end=',') i += 1
输出结果
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
以上就是python如何打印1~20的整数的详细内容,更多请关注php中文网其它相关文章!
已抢48483个
抢已抢3609个
抢已抢1455个
抢已抢1607个
抢已抢2335个
抢已抢3166个
抢