-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_manager.py
More file actions
83 lines (67 loc) · 2.72 KB
/
account_manager.py
File metadata and controls
83 lines (67 loc) · 2.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'''
Account manager with menu: User can make deposits, Do withdrawal and Check the balance
'''
print("ACCOUNT MANAGER \n")
pin = "0000"
saldo = 100.00
user_quit = False
pin_try = 0
while (True and user_quit != True):
user_pin = input("PIN: ")
pin_try = pin_try + 1
if user_pin == "0000":
print("WELCOME!")
print(f"Current saldo: {saldo} €")
while (True):
answer = input("Type D to make a deposit\nType W to make a withdrawal\nType S to view current saldo.\nType Q to quit the program\n")
answer = answer.upper()
if answer == "D":
while(True):
deposit = float(input("Type deposit amount:"))
saldo = saldo + deposit
print(f"Current saldo: {saldo} €")
user_continue = input("Do you want to make another deposit? Type Y to continue.\n")
user_continue = user_continue.upper()
if user_continue == "Y":
continue
else:
break
elif answer == "W":
while(True):
withdrawal = float(input("Type withdrawal amount:"))
if withdrawal > saldo:
print(f"Can't withdraw that much. Your current saldo is {saldo} €.")
user_continue2 = input("Continue? Y/N\n")
user_continue2 = user_continue2.upper()
if user_continue2 == "Y":
continue
else:
break
saldo = saldo - withdrawal
print(f"Current saldo: {saldo} €")
user_continue = input("Do you want to make another withdrawal? Type Y to continue.\n")
user_continue = user_continue.upper()
if user_continue == "Y":
continue
else:
break
elif answer == "S":
print(f"Current saldo: {saldo} €")
continue
elif answer == "Q":
user_quit = True
break
else:
print("Command not recognized. Try again.")
continue
else:
print("PIN is not correct!")
if pin_try == 1:
print(f"You can try 3 times: {pin_try} ")
continue
if pin_try == 2:
print(f"You can try 3 times: {pin_try} ")
continue
if pin_try == 3:
print("This was your third try! Bye!")
break