r/PythonLearning • u/Hefty_Courage3893 • Oct 15 '26
Help Request I’m stuck on this assignment
I never struggle on assignments but this one is so confusing for me
132
Upvotes
r/PythonLearning • u/Hefty_Courage3893 • Oct 15 '26
I never struggle on assignments but this one is so confusing for me
View all comments
12
u/PureWasian Oct 15 '26 edited Oct 15 '26
Follow the red squigglies. Your print statements need "quotation marks" or 'apostrophes' around the output strings, and your elif is missing a colon* and followup conditional block of code within it
Your code does not run otherwise.
The conditional statements don't do ranges in the way you are trying to do them as. 31-69 evaluates to -38 instead of being treated as a range.
Regarding the actual logic, you haven't given enough information from the problem statement as to why a nested if statement would be necessary instead of a simple if/elif chain (although you could do it as nested ifs if the solution checker demands the less elegant solution though)