-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpesaapp.py
More file actions
26 lines (23 loc) · 742 Bytes
/
mpesaapp.py
File metadata and controls
26 lines (23 loc) · 742 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
class MpesaAccount :
def __init__(self,name,phone,balance):
self.name=name
self.phone=phone
self.balance=balance
def deposit(self,amount):
self.balance +=amount
print("Deposited",amount)
print(f"Your balance is {self.balance}")
def withdraw(self,amount):
if amount <= self.balance:
self.balance -=amount
print(f"Withdraw {amount}")
print(f"New balance is {self.balance}")
else:
print("Insufficient balance")
def check_balance(self):
print(f"Balance is {self.balance}")
user1=MpesaAccount("Erick",2549029423,5000)
user1.check_balance()
user1.deposit(6456)
user1.check_balance
user1.withdraw(20000000000)