1+ #ATM Machine Using python
2+
3+ print ("=" * 30 , "Welcome to Python Bank ATM" , "=" * 30 )
4+
5+ restart = ("Y" )
6+ chances = 3
7+ balance = 999.99
8+
9+ while chances >= 0 :
10+ pin = int (input ("\n Please enter your 4 Digit pin: " ))
11+ if pin == (1234 ):
12+ print ("\n Correct pin!!" )
13+
14+ while restart not in ("n" , "no" , "N" , "NO" ):
15+ print ("\n Please Press 1 For Your Balance." )
16+ print ("Please Press 2 To Make a Withdrawl." )
17+ print ("Please Press 3 To Pay in." )
18+ print ("Please Press 4 To Return Card." )
19+
20+ option = int (input ("\n What Would you like to Choose?: " ))
21+
22+ if option == 1 :
23+ print (f"\n Your Balance is: ${ balance } " )
24+ restart = input ("\n Would You like to do something else? " )
25+
26+ if restart in ("n" , "no" , "N" , "NO" ):
27+ print ("\n Thank You\n " )
28+ break
29+
30+ elif option == 2 :
31+ option2 = ("y" )
32+ withdrawl = float (input ("\n How Much Would you like to withdraw? 10, 20, 40, 60, 80, 100 for other enter 1: " ))
33+
34+ if withdrawl in [10 , 20 , 40 , 60 , 80 , 100 ]:
35+ balance = balance - withdrawl
36+ print (f"\n Your balance after the withdrawl is ${ balance } " )
37+ restart = input ("\n Would You like to do something else? " )
38+
39+ if restart in ("n" , "no" , "N" , "NO" ):
40+ print ("\n Thank You\n " )
41+ break
42+
43+ elif withdrawl == 1 :
44+ withdrawl = float (input ("\n Please Enter Desired amount: " ))
45+ balance = balance - withdrawl
46+ print (f"\n Your balance after the withdrawl is ${ balance } " )
47+ restart = input ("\n Would You like to do something else? " )
48+
49+ if restart in ("n" , "no" , "N" , "NO" ):
50+ print ("\n Thank You\n " )
51+ break
52+
53+ elif withdrawl != [10 , 20 , 40 , 60 , 80 , 100 ]:
54+ print ("\n INVALID AMOUNT, Please try Again\n " )
55+ restart = ("y" )
56+
57+ elif option == 3 :
58+ pay_in = float (input ("\n How Much Would you like to Pay In? " ))
59+ balance = balance + pay_in
60+ print (f"\n Your balance after the Pay-in is ${ balance } " )
61+ restart = input ("\n Would You like to do something else? " )
62+
63+ if restart in ("n" , "no" , "N" , "NO" ):
64+ print ("\n Thank You\n " )
65+ break
66+
67+ elif option == 4 :
68+ print ("\n Please wait whilst your card is Returned...." )
69+ print ("\n Thank you for your service" )
70+ break
71+
72+ else :
73+ print ("\n Please enter a correct number.\n " )
74+ restart = ("y" )
75+
76+ elif pin != (1234 ):
77+ print ("\n INCORRECT PIN!!\n " )
78+ chances = chances - 1
79+
80+ if chances == 0 :
81+ print ("Calling the Police...\n " )
82+ break
0 commit comments