For this challenge you need to get creative as well as efficient to see how much you can get python to draw in lesson than 10s.
The code below measures how long the python code takes to run and displays the number of seconds since the program started. See how much you can draw in less than 10s by optimising the code as much as possible!
Use an image search to find some abstract art and try to draw it with python turtle
Use the timer in the code to see if you can make all your code run in less than 10s
Hint: you can use
t.speed(0) to speed up drawing with turtle graphics
See if you can work through each of these challenges:
- Use a for loop
The self marking test might not measure the drawing time correctly for turtle graphics so you’ll have to use the timings displayed on screen
- Use a while loop
Hint: A syntax error prevents the code from running
- Define a procedure
Hint: Use functions or procedures to avoid having to write the same lines of code multiple times
There are two more challenges which you’ll find when the tests run on your code. These aren’t anything to do with optimisation but you can use the
t.end_fill methods to pass these tests by adding your own splashes of colour.
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.