-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM_System.py
More file actions
33 lines (22 loc) · 803 Bytes
/
Copy pathATM_System.py
File metadata and controls
33 lines (22 loc) · 803 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
class ATM:
def __init__(self,account_holder,balance):
self.account_holder = account_holder
self.balance = balance
def deposit(self,amount):
self.balance+=amount
return f"${amount} deposited successfully."
def withdraw(self,amount):
if amount<= self.balance:
self.balance -=amount
return f"${amount} withdrawn successfully."
else:
return f"Insufficient Balance."
def check_balance(self):
return f"Available Balance: ${self.balance}"
def account_details(self):
return f"Account Holder: {self.account_holder}\nCurrent Balance: ${self.balance}"
user1= ATM("Rahul",5000)
print(user1.account_details())
print(user1.deposit(2000))
print(user1.withdraw(1500))
print(user1.check_balance())