0

Can anyone please tell me what's wrong with my code?

value = input("enter your name:") int(value) if value <= 5: print ("greater than 5") if value >= 5: print ("less than 5")

27th May 2020, 1:46 PM
Iyed Bouazdia
Iyed Bouazdia - avatar
9 Answers
+ 3
Iyed Bouazdia the code How can the input be in " " if you want to code with integers (int) Your mistake was value=input("Enter Your Name") But rather I will encourage you to use value=input() And also use the elif statement for the second one Thank you
27th May 2020, 1:53 PM
Isaac Duah [Active!]
Isaac Duah [Active!] - avatar
+ 2
Code Crasher that was I said in the answer
27th May 2020, 2:11 PM
Isaac Duah [Active!]
Isaac Duah [Active!] - avatar
+ 2
Code Crasher Yes that was what I was thinking about was it the length of the name?
27th May 2020, 2:22 PM
Isaac Duah [Active!]
Isaac Duah [Active!] - avatar
+ 1
Hay Iyed Bouazdia your code is also correct . But you had done one mistake you are talking input as string . And after that you are trying to convert it into int . Yes ofcourse you had converted it using int(value) but if no variable is assigned to it then how will it be used . So do a simple thing overwrite the value . Like this \/ value = input("enter your name:") value = int(value) if value <= 5: print ("greater than 5") if value >= 5: print ("less than 5") and second thing always take care of indentation in python. in your code second error is of indentation. ok
27th May 2020, 1:55 PM
Ayush Kumar
Ayush Kumar - avatar
+ 1
thanks guys, I really appreciate it. I got it now
27th May 2020, 2:03 PM
Iyed Bouazdia
Iyed Bouazdia - avatar
+ 1
code crasher thanks. That actually makes a lot of sense
27th May 2020, 4:34 PM
Iyed Bouazdia
Iyed Bouazdia - avatar