Created
May 18, 2020 17:28
-
-
Save Deep18-03/ddf6a0efb4fd9cae3ae43cc41c37ac0d to your computer and use it in GitHub Desktop.
simple atm code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ATM | |
def deposit(): | |
amount=int(input("enter the amount you want to deposit")) | |
global balance | |
balance=balance+amount | |
def withdraw(): | |
amount=int(input("enter the amount you want to withdraw")) | |
global balance | |
balance -=amount | |
def check_balance(): | |
global balance | |
print(f"your current balance is {balance} ") | |
balance=500 | |
chances=3 | |
for i in range(0,3): | |
pin=int(input("enter your pin")) | |
if pin==1234: | |
while True: | |
print(f"your current balance is {balance}") | |
print("Enter your choice") | |
print("1.withdraw 2.deposit 3.check balance") | |
option=int(input()) | |
if option==1: | |
withdraw() | |
elif option==2: | |
deposit() | |
else: | |
check_balance() | |
print(f"Now your balance is {balance}") | |
con=input("do you want yo continue Y or N ") | |
if con=="N" or con=="n": | |
break | |
else: | |
continue | |
else: | |
print("incorrect pin try again") | |
chances -=1 | |
if chances==0: | |
print("uabale to login") | |
exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment