Skip to content

Commit 178fb63

Browse files
committed
While loop fundamentals practice
1 parent 6081ee6 commit 178fb63

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

While-Loop/problem3.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## 🎯 Challenge #3: ATM PIN System 🏦
2+
3+
atm_pin = 1234
4+
user_id = 'kira'
5+
balance = 2500
6+
attempt = 0
7+
while True :
8+
user_name = input("Enter The User Id :").strip().lower()
9+
if user_name == user_id :
10+
while attempt < 3:
11+
atm_pass = input("Enter Your ATM PIN :").strip()
12+
if not atm_pass.isdigit():
13+
print("Please Enter Digits")
14+
if atm_pass ==atm_pin:
15+
print(f"Welcome {user_id}! Your current balance is {balance}.")
16+
exit()
17+
attempt += 1
18+
print(f"Incorrect PIN Attempt Left : {3 - attempt}")
19+
print('Too many incorrect attempts Try again some time later')
20+
break
21+
22+
else:
23+
print('Please enter valid user id')
24+

0 commit comments

Comments
 (0)