Overview
Import Python's Standard Library to solve real-world tasks without reinventing the wheel.
- import & from … import
- math, random, datetime
- Aliasing with as
Short Course
Python's Standard Library ships with powerful modules — import them at the top of your file and use them instantly.
import math
from random import randint
import datetime as dt # alias
print(math.sqrt(16)) # -> 4.0
print(math.pi) # -> 3.141592...
print(randint(1, 6)) # dice roll
print(dt.date.today()) # today's date
Task
Write get_circle_area(radius) using math.pi. Return the area rounded to
2 decimal places.
Test Suites
Pending
Stdout