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

  1. 1
    Your First Program and print

    Your first Python program: print, outputting text and calculations.

  2. 2
    Variables and Data Types

    Variables and the int, float, str, bool types; arithmetic and division quirks.

  3. 3
    Reading Input

    Reading input: input, int(input()) and map for several numbers on one line.

    1 problems

  4. 4
    Conditional Statements

    if/elif/else conditions, indentation as part of the syntax, and/or/not connectives.

    1 problems

  5. 5
    for and while Loops

    The for range and while loops: iteration, accumulators and standard tricks.

    2 problems

  6. 6
    Lists and Slices

    Lists: indices, slices, the built-in len, sum, max, min functions and sort.

    1 problems

  7. 7
    Strings

    Strings: indices, slices, the lower/upper/count methods and a palindrome check.

    3 problems

  8. 8
    Functions

    def and return, decomposition; GCD and a primality check up to the square root.

    2 problems

  9. 9
    Dicts, Sets and Collections

    Dictionaries and sets: counting occurrences, uniqueness, Counter.

  10. 10
    Contest Setup: Fast I/O

    Fast input via sys.stdin, Python's contest pitfalls and a checklist.

Доска