《本办法学python——习题37》
—————————————————————————————————————————————————————————————————————————————————————
便签堆了一桌,写一写理一理
—————————————————————————————————————————————————————————————————————————————————————
一. 关键字
1.判断、循环
——(for,while,if,elif,else,in,and,or,not)
1.1. 判断
and,or,not 用于判断条件的成立与否。
1.2. 循环
for循环——
for A in B/ for A range(c, d, f):
content
return X, Y, Z..
while循环——
while True:
content
return X,Y,Z..
1.3.补充——循环
break.(终止循环)
1 def test(a, b): 2 a = int(raw_input("> ")) 3 b = int(raw_input(">> ")) 4 5 while True: 6 if a >= b: 7 print a 8 break 9 else: 10 a += 1 11 12 print "Test is over." 13 14 15 num1 = 0 16 num2 = 0 17 test(num1, num2)
时间: 2024-10-28 11:23:23