Predict the Output: import vs from...import
Beginner · Predict the output · 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 lessonWhat will this code print?
from math import sqrt, pow
a = sqrt(49)
b = pow(2, 3)
print(a)
print(b)Remember that math.pow() returns a float.
# Type the exact output
More Imports exercises
- Use the random ModuleBeginner
- Fix the Bug: Broken ImportsBeginner
- Use Import AliasesBeginner
- Write a Module with __name__ GuardIntermediate
All Python exercises · 50 practice problems · Modules & Packaging quiz