-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM.py
More file actions
36 lines (35 loc) · 1.49 KB
/
ATM.py
File metadata and controls
36 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
print("Here's Your Basic ATM\n")
attempts = 0
balance = 100000
while attempts < 3:
pin = int(input("Please Enter Your Pin To Login Your Account\n"))
if pin == 3520:
print(f"\nAccount Holder : Gopal krishna.\nAccount Balance : {balance}")
while True:
print("""\nChoose an option:\n1. Withdraw\n2. Credit (Deposit)\n3. Check Balance\n4. Exit\n""")
choice = int(input("Enter Your Choice: "))
if choice == 1:
dp = int(input("Enter Amount To Withdraw: "))
if dp > balance:
print("\nInsufficient Balance!")
else:
balance -= dp
print(f"\nTransaction Successful!\nUpdated Balance : {balance}")
elif choice == 2:
credit = int(input("Enter Amount To Deposit: "))
balance += credit
print(f"\nAmount Credited Successfully!\nUpdated Balance: {balance}")
elif choice == 3:
print(f"\nYour Current Balance : {balance}")
elif choice == 4:
print("\nThank You For Using Our ATM!")
break
else:
print("Invalid Option, Try Again.\n")
break
else:
attempts += 1
if attempts == 3:
print("\nYour Account Has Been Blocked Due To Multiple Incorrect Attempts.")
else:
print(f"Incorrect Pin ({3 - attempts} attempts left)\n")