Imports and the standard library tour
- Stage
- 1
- Module
- M1.13
- Lessons
- 1
In this module
- Bring in a module, or one name from it, with
importandfrom ... import. - Use
math.gcd,math.comb,collections.Counteranditertools.combinationsto replace hand-written loops. - Read a function's entry in the Python docs before using it.
- Recognize a mistyped import as a
ModuleNotFoundError.
Before this module
Lessons
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2024 J3Bronze Count (opens on WMOJ in a new tab) WMOJ
Find the third-highest distinct score from a list of contest scores.
- 2016 S1Ragaman (opens on DMOJ in a new tab) DMOJ
Decide whether one word, with wildcards, can be rearranged into another.
Why DMOJ: A short Senior problem, included here for extra practice.