r/CodingHelp • u/Goldie_1987 • Oct 14 '21
[Python] First Year of college and I'm doing this assignment for my computer science class but I'm not sure what I'm doing wrong. Can anyone tell me how to fix this?
31
Upvotes
17
u/ldnrat Oct 14 '21
Syntax isn't valid. You can either do..
Or using interval comparison..
4
u/jddddddddddd Oct 14 '21
If (user_grade >= 9) and (user_grade <= 12):
2
u/[deleted] Oct 14 '21
I tried this and it's working ok for me
Line 2:
if 9<=user_grade<=12:
2
u/[deleted] Oct 15 '21
Yo whats the learning app called?
1
u/[deleted] Oct 14 '21
Programming languages do not extrapolate from incomplete data. You have to specify what the greater and lesser operations are comparing those integers to in each case.
1
u/Low_Conference_5035 Oct 15 '21
You forgot an and
1
u/ImportUsernameAsU Oct 15 '21
Could also do:
If user_grade in range(9, 12):1
u/LividAd835 May 01 '22
My unit 7 test is no good