Skip to content
CodeItRaw
Path

Start from zero: functions, conditions, loops and lists. Every later topic builds on these.

Key ideas

  • A function takes input and hands back its answer with return; print only writes to the screen.
  • if picks a path by a question; == asks whether two things are equal, % gives the remainder.
  • for repeats the same work: range(1, n + 1) counts from 1 to n, for v in values walks a list.
  • Start a variable before the loop (a counter, a total, a best), update it inside, return it at the end.

Pattern

count = 0
for v in values:
    if v > 0:
        count += 1
return count

Lessons

Each lesson explains one idea from zero and ends with a few tasks. Lessons open in order; the explanation can be read at any time.

  1. 01

    Functions and return

    0/2 tasks

  2. 02

    Conditions: if, elif, else

    0/3 tasks

  3. 03

    Repeating: for and range

    0/2 tasks

  4. 04

    Walking a list and counting

    0/3 tasks

  5. 05

    The best so far

    0/3 tasks

  6. 06

    Leaving early and building a list

    0/2 tasks

  7. 07

    Not knowing how many turns: while

    0/2 tasks

Boss

  • 08

    Fizz Counter

    Function

  • The boss opens when every lesson of the topic is finished. Solve it too and the topic is complete, and the topics after it open.