Python Syntax question

My solution

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

This is the solution provided by the system.

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

What is the point of paranthesis here?

if(rating <= 5):

I imagine it is just protocol, in order to make the code more readable; other developers can clearly see what is a condition and what is not. That is all I can see the point in it, in that exercise.

2 Likes