Skip to content

Instantly share code, notes, and snippets.

@Celia-code
Last active April 9, 2020 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Celia-code/0524a4e144df6efa452eee26c64ce2b8 to your computer and use it in GitHub Desktop.
Save Celia-code/0524a4e144df6efa452eee26c64ce2b8 to your computer and use it in GitHub Desktop.
break&continue
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