The import after moving a file into a folder

Code review · Medium · §12.4, §12.5 Packages

You moved counts.py into a social folder to make a package. Since then, the code below stops with an error on the first line. Keep the folder structure as it is and fix the import line. Grading also runs the code with other lists in changes.

Code to fix

from counts import gains

changes = [12, -3, 30, 8]
print("Likes gained:", gains(changes))

File social/__init__.py

File social/counts.py

def gains(changes):
    result = 0
    for c in changes:
        if c > 0:
            result += c
    return result

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.