- 1

Why does this have invalid sintax

so i was messing around with one of the try it yourself codes from a lesson and wrote this grade = input('Enter : ') if(grade >= 70 and grade <= 100): print("Passed!") else: print("Failed") For some reason it says syntax error on the second line i dont understand

25th Sep 2020, 4:41 AM
codewizz
4 Answers
+ 2
Try it grade = int(input('Enter : '))
25th Sep 2020, 4:45 AM
Vadivelan
+ 1
Vadivelan that won't give syntax error , instead type error for operation >= . Think codewizz is getting type error đŸ€” There seems no syntax error
25th Sep 2020, 4:46 AM
Akash Kumar S
Akash Kumar S - avatar
0
yea its a type error but i dont know what i did wrong. is it line spacing or an incorrect indent??
25th Sep 2020, 1:25 PM
codewizz
0
Input() will get an input string from the user . If u want to compare it with a integer , you should first convert it to integer with int ( input() ) . You didn't do that . That why it shows type error .
25th Sep 2020, 2:12 PM
Akash Kumar S
Akash Kumar S - avatar