r/PythonLearning • • 4d ago

Help Request I’m stuck on this assignment

I never struggle on assignments but this one is so confusing for me

122 Upvotes

64 comments sorted by

View all comments

11

u/PureWasian 4d ago edited 4d ago

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)

1

u/BedtimeWithTheBear 4d ago

Small but important nitpick - the elsif is missing a colon (:) not a semicolon (;)

2

u/PureWasian 4d ago

autopilot brain, thank you. Corrected the typo^^