A title overwritten by a star import
Code review · Medium · §12.3 from, as, and the star
This code prints a post title and the average number of likes. The function average(), which computes the average, is in report.py in the same folder. An AI wrote the import line as from report import *. The code runs without errors, but the wrong title is printed instead of My post. Leave the title line as it is and fix just one line. Grading also runs the code with a different title and different likes.
Code to fix
title = "My post"
from report import *
likes = [120, 80, 100]
print(title, average(likes))File report.py
title = "Weekly report"
def average(values):
return sum(values) / len(values)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.