Lecture 3 Exercises¶
The following code has a bunch of errors. Try to fix them, so the code will run! As you do so, examine the error messages carefully: why are they happening? Each time you fix an error in a line of code, think about an explanation: what was wrong with it? How did you fix it? (If you’re doing this on paper, you can just make notes about what errors there are and how you could fix them.
This is an exercise in thought and debugging. (Note that it may be surprising which errors Python gets caught at first – when you fix one, you’ll find another, which is exactly what happens when you make errors by accident!)
Try to write code to draw a triangle with the
turtle
module. (If you have time/want to try, attempt some more fun shapes: a star? A heart? What about a small square shape inside a larger square shape?)