Skip to content

Commit 3076f77

Browse files
Merge pull request #226 from PritKalariya/main
Implemented an ATM Machine logic using python.
2 parents 6a315dd + 02b9891 commit 3076f77

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

ATM.py

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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("\nPlease enter your 4 Digit pin: "))
11+
if pin == (1234):
12+
print("\nCorrect pin!!")
13+
14+
while restart not in ("n", "no", "N", "NO"):
15+
print("\nPlease 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("\nWhat Would you like to Choose?: "))
21+
22+
if option == 1:
23+
print(f"\nYour Balance is: ${balance}")
24+
restart = input("\nWould You like to do something else? ")
25+
26+
if restart in ("n", "no", "N", "NO"):
27+
print("\nThank You\n")
28+
break
29+
30+
elif option == 2:
31+
option2 = ("y")
32+
withdrawl = float(input("\nHow 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"\nYour balance after the withdrawl is ${balance}")
37+
restart = input("\nWould You like to do something else? ")
38+
39+
if restart in ("n", "no", "N", "NO"):
40+
print("\nThank You\n")
41+
break
42+
43+
elif withdrawl == 1:
44+
withdrawl = float(input("\nPlease Enter Desired amount: "))
45+
balance = balance - withdrawl
46+
print(f"\nYour balance after the withdrawl is ${balance}")
47+
restart = input("\nWould You like to do something else? ")
48+
49+
if restart in ("n", "no", "N", "NO"):
50+
print("\nThank You\n")
51+
break
52+
53+
elif withdrawl != [10, 20, 40, 60, 80, 100]:
54+
print("\nINVALID AMOUNT, Please try Again\n")
55+
restart = ("y")
56+
57+
elif option == 3:
58+
pay_in = float(input("\nHow Much Would you like to Pay In? "))
59+
balance = balance + pay_in
60+
print(f"\nYour balance after the Pay-in is ${balance}")
61+
restart = input("\nWould You like to do something else? ")
62+
63+
if restart in ("n", "no", "N", "NO"):
64+
print("\nThank You\n")
65+
break
66+
67+
elif option == 4:
68+
print("\nPlease wait whilst your card is Returned....")
69+
print("\nThank you for your service")
70+
break
71+
72+
else:
73+
print("\nPlease enter a correct number.\n")
74+
restart = ("y")
75+
76+
elif pin != (1234):
77+
print("\nINCORRECT PIN!!\n")
78+
chances = chances - 1
79+
80+
if chances == 0:
81+
print("Calling the Police...\n")
82+
break

0 commit comments

Comments
 (0)