+ 1

why this happens in term of understanding the code this should be right isn't it ?

a=1379 if a==2758: print("no this data you have provided is worng !") elif a==(input(" ")): print("yeh procede ahead > ")

4th May 2018, 7:18 AM
Anmol Dhakal
4 Respostas
+ 4
1. Put input to top 2. Change a from int to str 3. Switch if clause from == to != 4. Change elif to else: Voila!
4th May 2018, 9:36 PM
Johannes
Johannes - avatar
+ 8
If you are thinking of comparing an input to a variable, it has to be queried before the comparison, not after. Also, the types have to be the same - so either make the variable string or make the input integer.
4th May 2018, 7:37 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 8
a=1379 # I assume this is the password i = int(input("Enter password: ")) if a!=i: # if password is wrong print("no this data you have provided is worng !") else: # if password is right print("yeh procede ahead > ")
4th May 2018, 7:48 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
can you please make this code correct what am trying to do that in that way
4th May 2018, 7:42 AM
Anmol Dhakal