Paul's Python CoursePPC

The standard library

Not met yet

Python ships with a shelf of modules you only have to import. math has ceil, floor and sqrt; datetime handles dates, times and the gaps between them; collections.Counter counts things; itertools has tools for loops, like accumulate for running totals. Look on the shelf before you build your own.

Try it

main.py
import math
from collections import Counter
from datetime import datetime, timedelta
from itertools import accumulate

print(math.ceil(3.25))
print(datetime(2026, 3, 14).strftime("%A"))
print(datetime(2026, 3, 14) + timedelta(days=1))
print(Counter("kale kale plums".split()).most_common(1))
print(list(accumulate([40, 25, 60])))

Output

Press Run and what your program prints shows up here.

Easy to get wrong

  • Thinks datetime's weekday() counts from Sunday, or from 1. It counts Monday as 0.
  • Thinks math.ceil rounds to the nearest whole number, rather than always up.
  • Thinks Counter's most_common(1) gives back just the item, rather than a list of (item, count) pairs.

Where it comes up