-
Notifications
You must be signed in to change notification settings - Fork 0
/
ATM.py
82 lines (63 loc) · 2.94 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
78
79
80
81
82
#ATM Machine Using python
print("="*30, "Welcome to Python Bank ATM", "="*30)
restart = ("Y")
chances = 3
balance = 999.99
while chances >= 0:
pin = int(input("\nPlease enter your 4 Digit pin: "))
if pin == (1234):
print("\nCorrect pin!!")
while restart not in ("n", "no", "N", "NO"):
print("\nPlease Press 1 For Your Balance.")
print("Please Press 2 To Make a Withdrawl.")
print("Please Press 3 To Pay in.")
print("Please Press 4 To Return Card.")
option = int(input("\nWhat Would you like to Choose?: "))
if option == 1:
print(f"\nYour Balance is: ${balance}")
restart = input("\nWould You like to do something else? ")
if restart in ("n", "no", "N", "NO"):
print("\nThank You\n")
break
elif option == 2:
option2 = ("y")
withdrawl = float(input("\nHow Much Would you like to withdraw? 10, 20, 40, 60, 80, 100 for other enter 1: "))
if withdrawl in [10, 20, 40, 60, 80, 100]:
balance = balance - withdrawl
print(f"\nYour balance after the withdrawl is ${balance}")
restart = input("\nWould You like to do something else? ")
if restart in ("n", "no", "N", "NO"):
print("\nThank You\n")
break
elif withdrawl == 1:
withdrawl = float(input("\nPlease Enter Desired amount: "))
balance = balance - withdrawl
print(f"\nYour balance after the withdrawl is ${balance}")
restart = input("\nWould You like to do something else? ")
if restart in ("n", "no", "N", "NO"):
print("\nThank You\n")
break
elif withdrawl != [10, 20, 40, 60, 80, 100]:
print("\nINVALID AMOUNT, Please try Again\n")
restart = ("y")
elif option == 3:
pay_in = float(input("\nHow Much Would you like to Pay In? "))
balance = balance + pay_in
print(f"\nYour balance after the Pay-in is ${balance}")
restart = input("\nWould You like to do something else? ")
if restart in ("n", "no", "N", "NO"):
print("\nThank You\n")
break
elif option == 4:
print("\nPlease wait whilst your card is Returned....")
print("\nThank you for your service")
break
else:
print("\nPlease enter a correct number.\n")
restart = ("y")
elif pin != (1234):
print("\nINCORRECT PIN!!\n")
chances = chances - 1
if chances == 0:
print("Calling the Police...\n")
break