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!"
The code
def movie_review(rating):
if rating <= 5:
return print("Avoid at all costs!")
if (rating >= 5 and rating < 9):
return print("This one was fun.")
else:
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!"
What happens when you remove the two print() that follow the return inside the function?
Hint: you don’t need to use print()inside the function b/c you’re returning a value. You have print() both inside AND outside the function. None happens when there is no value to return.