减少循环 [英] Decrementing for loops
本文介绍了减少循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用于范围内的计数器(10,0):
打印计数器,
,输出应该是10 9 8 7 6 5 4 3 2 1 < (str(i)for i in range(10,p))($ str(i) 0,-1))
print(a)
I want to have a for loop like so:
for counter in range(10,0):
print counter,
and the output should be 10 9 8 7 6 5 4 3 2 1
解决方案
a = " ".join(str(i) for i in range(10, 0, -1))
print (a)
这篇关于减少循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文