codegurukool.com · Free coding tutorials & online compiler

Home › Python Tutorial › Python modules, dates and math

Python modules, dates and math

Use code that others wrote.

import brings in a module. The standard library includes math, datetime, random, json and many more. strftime formats a date as text.

Example code

import math
import datetime
print(math.sqrt(81), math.pi)
d = datetime.date(2026, 12, 25)
print(d.strftime("%A, %d %B %Y"))
print(list(range(0, 10, 3)))

Run this code in the online editor

← Python functionsPython JSON and RegEx →