PythiloLesson 1 of 30 · progress kept in this browser

Modules and imports

Every .py file is a module. A folder of modules is a package. import runs a module's top-level code once, caches it in sys.modules, and gives you a name for it.

import math
import json as js
from collections import Counter

print(math.pi)
print(js.dumps({"a": 1}))
print(Counter("aab"))
Your task

Import from the standard library at the top of the file. Write circle_area(r) using math.pi. Write most_common_word(words) using from collections import Counter, returning the most frequent word (first seen wins a tie) or None for an empty list. Write to_json(data) returning JSON text with sorted keys.

Next: Packages