-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatm.py
More file actions
32 lines (25 loc) · 1004 Bytes
/
Copy pathatm.py
File metadata and controls
32 lines (25 loc) · 1004 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
balance = 10000 # Initial balance
print(" Welcome to ATM Withdrawal System")
print(" Your initial balance is: ₹", balance)
while True:
print(f"1️ Withdraw Money")
print(f"2️ Exit")
choice = input("Enter your choice (1 or 2): ")
if choice == "2":
print(" Thank you for using the ATM. Goodbye!")
break
elif choice == "1":
try:
amount = float(input("Enter withdrawal amount: ₹"))
if amount <= 0:
raise ValueError(" Withdrawal amount must be greater than zero!")
if amount > balance:
raise ValueError("Insufficient balance! You cannot withdraw more than " + str(balance))
balance -= amount
print(" Withdrawal successful!")
print(" You withdrew: ₹", amount)
print(" Remaining balance: ₹", balance)
except ValueError as e:
print("Error:", e)
else:
print(" Invalid choice! Please enter 1 or 2.")