-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM_simulation.py
More file actions
39 lines (33 loc) · 887 Bytes
/
Copy pathATM_simulation.py
File metadata and controls
39 lines (33 loc) · 887 Bytes
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
balance = 1000
def check_balance():
print("Current Balance:", balance)
def deposit():
global balance
amount = float(input("Enter amount to deposit: "))
balance += amount
print("Amount deposited!")
def withdraw():
global balance
amount = float(input("Enter amount to withdraw: "))
if amount > balance:
print("Insufficient balance!")
else:
balance -= amount
print("Withdrawal successful!")
while True:
print("\n----- ATM MENU -----")
print("1. Check Balance")
print("2. Deposit")
print("3. Withdraw")
print("4. Exit")
choice = int(input("Enter choice: "))
if choice == 1:
check_balance()
elif choice == 2:
deposit()
elif choice == 3:
withdraw()
elif choice == 4:
break
else:
print("Invalid choice!")