-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM python.py
More file actions
46 lines (37 loc) · 1.31 KB
/
ATM python.py
File metadata and controls
46 lines (37 loc) · 1.31 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
37
38
39
40
41
42
43
44
45
46
print("Hello! Welcome to our ATM")
balance = 10000
pin = input("Set Your PIN: ")
entered_pin = input("Enter your ATM PIN: ")
if entered_pin == pin:
while True:
print("\n--- ATM MENU ---")
print("1. Check Balance")
print("2. Deposit")
print("3. Withdraw")
print("4. Exit")
choice = input("Enter your choice: ")
if choice == "1":
print("Your balance is:", balance)
elif choice == "2":
amount = int(input("Enter amount to deposit: "))
if amount > 0:
balance += amount
print("Deposit successful")
print("Updated balance:", balance)
else:
print("Invalid amount")
elif choice == "3":
amount = int(input("Enter amount to withdraw: "))
if amount > 0 and amount <= balance:
balance -= amount
print("Please collect your cash")
print("Remaining balance:", balance)
else:
print("Insufficient balance or invalid amount")
elif choice == "4":
print("Thank you for using the ATM")
break
else:
print("Invalid choice")
else:
print("Incorrect PIN. Access denied.")