All labs

Program a siege

Write real Python against a world that answers back. Start by printing one line, end by writing a program that hunts for a target it cannot see — picking up variables, if/else, random, input, loops and functions on the way.

0 of 10 steps done0%
Start: What a program is
Before you write a programOptional warm-upInstructions, variables, loops, and the difference between printing and returning.
  1. Say something

    print, and asking the world a question

  2. Take aim

    Variables, and arithmetic with them

  3. Through the fog

    if and else — a program that decides

  4. Battle cries

    Lists, and asking for something random

  5. The captain decides

    input, and why it is never a number

  6. A volley

    for loops — say it once, do it many times

  7. Write the rule down

    Functions, and the difference between return and print

  8. Until it falls

    while loops, and keeping a record

  9. What comes next

    The parts of programming this lab left out