Last active
April 9, 2020 11:10
-
-
Save Celia-code/0524a4e144df6efa452eee26c64ce2b8 to your computer and use it in GitHub Desktop.
break&continue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username = "user" | |
n = 1 | |
while True: | |
a = input("請輸入用戶名:") | |
if n == 3 or a == username: | |
print("輸入正確" if a == username else "輸入錯誤次數已超過3次") | |
break | |
else: | |
print("用戶名有誤,請重新輸入!") | |
n += 1 | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment