Exam Block #1: Modules and Packages
12% of the examWhat this topic covers
Work with imports and nested packages, and understand how Python finds modules through sys.path. Use tools such as dir(), math, random, and platform to inspect modules and runtime details.
What is the difference between import math and from math import sqrt?
import math binds the module name, so you call math.sqrt(). from math import sqrt binds only that function name, so you call sqrt() directly. Both load the module once, and the choice only changes how names are written in your code.