# break and continue while True: print('Who are you ? ') name = input() if name != 'Joe': continue # while循环内部,continue 后面的代码不会执行,会重新回到while开始处,重新判断 print('Hello,Joe. What is the password? (It is a fish.)') password = input() if password == 'swordfish': break # 跳出整个while循环 print('Access granted!')
break & continue
于 2022-11-01 15:45:43 首次发布