-
Notifications
You must be signed in to change notification settings - Fork 0
/
atm.py
77 lines (71 loc) · 2.9 KB
/
atm.py
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
class ATM:
balance = 1000
chance = 3
restart = "y"
print("Welcome to Python Bank")
while chance >= 0:
print("Please enter your PIN : ")
id = input()
if id == '9999':
while restart not in ('N', 'N', 'No', 'NO', 'no'):
print("Welcome")
print("Choice any option")
print("1. Check your account balance \t "
"2. Withdraw funds \t"
"3. Deposit Money \t "
"4. SMS account details \t"
"5. Exit")
choice = int(input("choice : "))
if choice == 1:
print("Your account balance is : ", balance)
print("Go back (y/n): ")
restart = input()
if restart == ('n', 'N', 'No', 'NO', 'no'):
print("Thank you")
break
elif choice == 2:
print("Enter withdraw amount: ")
withdraw = int(input())
balance = balance -withdraw
print("Your withdraw money: ", withdraw)
print("Your new balance is : ", balance)
print("Go back (y/n): ")
restart = input()
if restart in ('n', 'N', 'No', 'NO', 'no'):
print("Thank you")
break
elif choice == 3:
print("How much do you want to deposit :")
deposit = int(input())
balance = balance + deposit
print("Your new balance is : ", balance)
print("Go back (y/n): ")
restart = input()
if restart in ('n', 'N', 'No', 'NO', 'no'):
print("Thank you")
break
elif choice == 4:
print("Enter your mobile phone")
number = input()
if number == "123456789":
print("SMS sent ")
else:
print("This is not a valid phone number")
print("Go back (y/n)")
if restart in ('n', 'N', 'No', 'NO', 'no'):
print("Thank you")
break
elif choice == 5:
print("Thank you, have a nice day")
break
else:
print("Please enter a valid option :")
restart = 'y'
elif id != '1234':
print("Please enter a valid PIN: ")
chance = chance -1
if chance == 0:
print("No more tries ")
break
elif restart == 'n':
break