Python基础-for循环
1.for 指定遍历
for i in rang(50,100,2): # 2 为步长
print (i) #输出:50 52 54 ~
2.for 不同遍历
list = [1,2,3,4]
tuple = (5,6,7,8)
dict = {"name":"python","age":18}
col = {"a","b","c"}
#字典默认遍历得到的是键
#遍历字典里面的值
for i in dict:
print (dict[i]) #输出: python 18
网友评论