python中for循环语句的用法
- range()函数创建的整数列表
n=1
for i in range(5,0,-1)
n = (n+1) <<1
print(n)
2.遍历字符串
template = "零一二三四五六七八九"
s = input()
for c in s:
print(template[eval(c)], end="")
- 遍历列表
languages = ["C", "C++", "Perl", "Python"]
for x in languages:
print (x)
网友评论