forked from fenyx-it-academy/Class5-Python-Module-Week6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
35 lines (17 loc) · 955 Bytes
/
client.py
File metadata and controls
35 lines (17 loc) · 955 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
from random import randint
class Client:#I defined a class Client
account={}
def __init__(self,name,total_amount):#Class Client have account_number, name, total_amount attributes
self.account["name"]=name
self.account["balance"]=total_amount
self.account["account_number"]=randint(10000,99999)# assign a random 5 digit int to account_number
def withdraw(self,amount): #withdraw, deposit and balance methods.
self.account["balance"] -=amount
print(f"the sum of {amount} has been withdrawn from your account balance")
self.balance()
def deposit(self,amount):
self.account["balance"] += amount
print(f"the sum of {amount} has been added to your account balance")
self.balance()
def balance(self):
print("Your current account balance is: {} ".format(self.account["balance"]))