I want to know about errors in this program! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to know about errors in this program!

print =input("enter card number") print=input("enter password:") if "password" =="card number": print("withdrawl\n" or"balance enquiry") else: print("wrong password") print=int(input("enter amount:")) if"enter amount"<="balance": print("thank you") else: print("no") quit()

26th Mar 2017, 6:26 AM
Unnati Jain
Unnati Jain - avatar
3 Answers
+ 8
you can't use 'print' as a variable either. It's a Python keyword
26th Mar 2017, 12:44 PM
LayB
LayB - avatar
+ 2
First, you don't use variables. You have one variable named print that you never use, and then you compare two strings: "password" and "card number" change first two lines to: card_number = input("Enter card number:") password = input("Enter password:") and then change your if statement to: if password = card_number: .... But this is comparing your password with your card number which kinda doesn't make sense.. And then you make the same mistake with amount. You store it in a variable print and then compare two strings. Change that to: amount = int(input("Enter amount:")) #let's say we have a default balance of 1000 balance = 1000 if amount <= balance: ..... Something like this should work.
26th Mar 2017, 9:13 AM
superdarkec
superdarkec - avatar
0
thank you @superdarkec and @LayB
26th Mar 2017, 1:42 PM
Unnati Jain
Unnati Jain - avatar