0

My programme should exit after insert wrong input

I just started learn python i wrote this program i dont know how to be programe exit after insert wrong input like when we enter our name “meet” but i entered “45” my programe should exit here by giving “u press wrong key” pls help me My code is #welcome line of sbi bank atm for custmer print("HI WELCOME TO SBI BANK ATM") #we will ask name for the custmer name = input(str("PLEASE ENTER YOUR NAME?\n ")) print("NICE TO MEET YOU,", name) #now we will ask for the age and this is a caution for age!!!!!! print(''' As students are always on the run and are usually deprived to free time, this account and debit card gives them the freedom from visiting the bank branch for making transactions. Youth Debit Card: Youth Debit Card is offered to people between the age of 18 years to 25 years. ''') #what is the age age = input("WHAT IS YOUR age?\n ") age = int(age) if(age>18): print("YOU CAN GET MONEY") elif age==18: print("you can get money") else: print("SORRY YOU CAN'T GET MONEY") print("CONGRATION! YOU CAN GET MONEY!", name) #ask for mobile number mobile = input("PLEASE ENTER YOUR MOBILE NUMBER?\n ") #now we will ask for account number account = input("PLEASE ENTER YOUR 11 DIGIT ACCOUNT NUMBER? ") print("THANK YOU", name) #here is amount page print('''100 200 500 2000 CUSTOM''') #ENTER MONEY money = input("PLEASE ENTER YOUR AMOUNT= ") print("PLEASE COLLECT YOUR CASH", name) print("THANKS FOR VISITING HERE GOOD DAY", name) print("good life")

26th Aug 2020, 5:00 PM
Meet Odishow
Meet Odishow - avatar
3 Respostas
+ 4
Hi, for a good exit you should put it all into a function. it is. def greeting() : #all your code here greeting() now for exit it is a simple return to leave
26th Aug 2020, 5:12 PM
Oma Falk
Oma Falk - avatar
+ 1
Oh, man! There are a lot of things you can write better. But if to answer your question, if name.isalpha(): Blabla if age.isdigit(): Blabla
26th Aug 2020, 5:11 PM
Shadoff
Shadoff - avatar
0
So you want your program to exit if the name input contains any integers? I am trying to understand the request a little better
26th Aug 2020, 5:09 PM
Steven M
Steven M - avatar