站长资源脚本专栏
浅析python中while循环和for循环
简介while循环只要循环条件为True(以下例子为x > y),while循环就会一直 执行下去:u, v, x, y = 0, 0, 100, 30 --- while x > y: u = u + y x = x - y if x < y + 2:
while循环
只要循环条件为True(以下例子为x > y),while循环就会一直 执行下去:
u, v, x, y = 0, 0, 100, 30 "htmlcode">item_list = [3, "string1", 23, 14.0, "string2", 49, 64, 70] for x in item_list: "found an integer divisible by seven: %d" % x) break "htmlcode">found an integer divisible by seven: 49上面就是关于while和for循环的全部知识点,感谢大家的学习和对的支持。
下一篇:Python的缺点和劣势分析