-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanking
More file actions
50 lines (38 loc) · 1.13 KB
/
banking
File metadata and controls
50 lines (38 loc) · 1.13 KB
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
40
41
42
43
44
45
46
47
48
49
50
money = 0
is_running = True
def ballance():
with open('ballance.txt', 'r') as f:
data = f.read().strip()
print("Your account balance is", data)
def withdrawl():
global money
with open('ballance.txt', 'r') as f:
money = int(f.read().strip())
take = int(input("\nHow much do you want to withdraw: "))
money -= take
with open('ballance.txt', 'w') as f:
f.write(str(money))
def deposit():
global money
with open('ballance.txt', 'r') as f:
money = int(f.read().strip())
give = int(input("\nHow much do you want to deposit: "))
money += give
with open('ballance.txt', 'w') as f:
f.write(str(money))
while is_running == True:
print("\naccount ballance (1)")
print("whithdrawl (2)")
print("deposit (3)")
print("exit (q)")
choice = input("\nselect youre option: ")
if choice == "q":
quit()
elif choice == "1":
ballance()
elif choice == "2":
withdrawl()
elif choice == "3":
deposit()
else:
print("invalid option ")