PYTHON CORE · LESSON 37

Finished module

import math · about 11 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

Connect the ready tools.

The word import connects the module. The math module has mathematical functions.

import math
print(math.sqrt(9))

✦ sqrt finds the square root: answer 3.0.

STEP 2

Module name before function

The math.sqrt recording shows that sqrt is taken from math.

import math
answer = math.sqrt(25)
print(answer)

✦ The screen will be 5.0.

IN-CLASS PRACTICE

Type the code yourself

Reprint the module connection and calculation.

import math
print(math.sqrt(9))
Open the editor for class work
HOMEWORK

Solve it yourself

Connect math and derive the square root of 16 using math.sqrt.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework