18: Parameters in python

Debug it

Parameters: Adapt and reuse sections of your code

Below is some code that has been deliberately broken so that you can fix it. 

The code is supposed to draw a snowman with an orange nose and two eyes:


  1. Fix the syntax errors

    Hint: parameters need be surrounded by brackets and separated by commas

  2. Change the nose to orange

    Hint: This is a logic error. The code runs (so it can’t be a syntax error) and doesn’t crash (so it’s not a runtime error). 

  3. Add the missing eye so it’s symmetrical

    Hint: The coordinates (0,0) are in the middle. Positive coordinates go left and up from the middle. 

On the next page you’ll get some ideas for projects where you can use functions in your own projects

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

Leave a Reply