Fix the Bug: Broken Imports
Beginner · Fix the bug · from Python Imports: How import Really Works (Modules, Packages, Paths)
From the lesson: Python Imports: How import Really Works (Modules, Packages, Paths)
Think of a library. Instead of buying every book in the world and keeping them in your house, you go to the library and check out only the books you need. When you're done, you return them.
Read the lessonThis code has import errors. Fix all the problems so it runs correctly and produces the expected output.
Expected output:
4.0
3.141592653589793
5from math import sqrt
from math import pi
print(sqrt(16))
print(pi)
print(math.gcd(10, 15))
More Imports exercises
- Predict the Output: import vs from...importBeginner
- Use the random ModuleBeginner
- Use Import AliasesBeginner
- Write a Module with __name__ GuardIntermediate
All Python exercises · 50 practice problems · Modules & Packaging quiz