FAQ: Code Challenge: Control Flow - Movie Review

This community-built FAQ covers the “Movie Review” exercise from the lesson “Code Challenge: Control Flow”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Movie Review

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

6 posts were split to a new topic: Why does my function print “none”?

2 posts were split to a new topic: Is there another way to check for interval?

2 posts were split to a new topic: Can else be omitted?

2 posts were split to a new topic: Why do I get a syntax error?

2 posts were merged into an existing topic: Can else be omitted?

Hi everyone!

I just have a quick question to fully understand this simple boolean code.

If the movie rating is less than or equal to 5 prints something, if it is less than 9, prints something else. Fine. But 4 is less than 5 AND less than 9. Wouldn’t that rating print “Avoid at all costs” and “This one was fun”?

Sorry for my ignorance I am very new at coding, and thank you in advance.

Write your movie_review function here:

def movie_review(rating):
if(rating <= 5):
return “Avoid at all costs!”
if(rating < 9):
return “This one was fun.”
return “Outstanding!”

Uncomment these function calls to test your movie_review function:

print(movie_review(9))

should print “Outstanding!”

print(movie_review(4))

should print “Avoid at all costs!”

print(movie_review(6))

should print “This one was fun.”

Yes, that is so, however since we return for the first test, that value will have been processed and the second if will never be seen since we’ve exited the function.

Oh I see. That makes sense. Thank you.

1 Like