Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code = str(4812)
- attempt = 0
- while attempt <= 3:
- user_try = input("enter your code")
- counter = 0
- if "4" in user_try:
- counter += 1
- else:
- counter
- if "8" in user_try:
- counter += 1
- else:
- counter
- if "1" in user_try:
- counter += 1
- else:
- counter
- if "2" in user_try:
- counter += 1
- else:
- counter
- if user_try == code:
- if user_try[0] == code[0] and user_try[1] == code[1] and user_try[2] == code[2] and user_try[3] == code[3]:
- print("The safe is now open")
- break
- else:
- print(f"you have {counter} digits of the code ")
Add Comment
Please, Sign In to add comment