Python from Scratch
Python is the easiest language to start with. This course goes from your first program to the level where you can start solving contest problems.
In this section
- 1Your First Program and print
Your first Python program: print, outputting text and calculations.
- 2Variables and Data Types
Variables and the int, float, str, bool types; arithmetic and division quirks.
- 3Reading Input
Reading input: input, int(input()) and map for several numbers on one line.
1 problems
- 4Conditional Statements
if/elif/else conditions, indentation as part of the syntax, and/or/not connectives.
1 problems
- 5for and while Loops
The for range and while loops: iteration, accumulators and standard tricks.
2 problems
- 6Lists and Slices
Lists: indices, slices, the built-in len, sum, max, min functions and sort.
1 problems
- 7Strings
Strings: indices, slices, the lower/upper/count methods and a palindrome check.
3 problems
- 8Functions
def and return, decomposition; GCD and a primality check up to the square root.
2 problems
- 9Dicts, Sets and Collections
Dictionaries and sets: counting occurrences, uniqueness, Counter.
- 10Contest Setup: Fast I/O
Fast input via sys.stdin, Python's contest pitfalls and a checklist.