0

Can anyone explain this code to me?

Create a function named movie_review() that has one parameter named rating. If rating is less than or equal to 5, return "Avoid at all costs!". If rating is between 5 and 9, return "This one was fun.". If rating is 9 or above, return "Outstanding!" CODE : # 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." Here they didn't write any condition for 5 < rating < 9 but still its working and also they have written only return "Outstanding!" line number 7 but how is it working?

5th Aug 2020, 1:26 PM
RH Tasin
RH Tasin - avatar
1 Resposta
+ 3
Link your code don't type it here!
5th Aug 2020, 1:33 PM
Rawley
Rawley - avatar