Guest User

bank python

a guest
Sep 16th, 2020
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #cash machine
  2. balance = 1000
  3.  
  4. def verify_pin(pin):
  5. if pin == '1234':
  6. return True
  7. else:
  8. return False
  9.  
  10. def log_in():
  11. tries = 0
  12. while tries < 4:
  13. pin = input('Please Enter Your 4 Digit Pin: ')
  14. if verify_pin(pin):
  15. print("Pin accepted!")
  16. return True
  17. else:
  18. print("Invalid pin")
  19. tries += 1
  20. print("To many incorrect tries. Could not log in")
  21. return False
  22.  
  23. def start_menu():
  24. print("Welcome to Natwest atm!")
  25. if log_in():
  26. print("Your balance is £{}.".format(balance))
  27.  
  28. start_menu()
Advertisement
Add Comment
Please, Sign In to add comment