You are going to screenshot all of your work into a Powerpoint file.
To save your powerpoint go to: File explorer -> Year 9 Common Area:S -> You can save here -> Computer Science -> Term 1 -> Lesson2
Save the Powerpoint file: as your name
When we wrote our square function, the code looked like this… .
# This is a function called drawsSquare def drawSquare(): for myMoves in range(4): tim.forward(100) tim.left(90)
Tick each task when you have successfully done it in the following list:
This is what your code should look something like
for myMoves in range(8): drawsquare(50) tim.left(45)
squareSize=50 for myMoves in range(8): drawsquare(squareSize) squareSize+=10 tim.left(45)
Tick each extension task when you have completed it in the following list:
import turtle # Set up the window and its attributes wn = turtle.Screen() # Choose our background colour. US spelling. wn.bgcolor("white") # Window title wn.title("Turtle Power") # Create tim and set some attributes tim = turtle.Turtle() tim.pensize(2) def drawsquare(sideLength,newColour): tim.color(newColour) for x in range(4): tim.forward(sideLength) tim.left(90) for myMove in range(10): # Create the square with a size and a colour. drawsquare(50,"red") tim.left(360/10) # Wait until the window is closed. wn.mainloop()
Sometimes, it's handy to store several pieces of information so that we can access them all when we need them. For this, we use a list.
Type these commands into a new Thonny file one at a time to get the hang of manipulating lists:
someColours=['Red','Blue','Pink','Black'] print(someColours[0]) someColours.append('Green') print(someColours) someColours.sort() print(someColours) someColours.reverse() print(someColours) someColours.pop() print(someColours) someColours.pop(1) print(someColours)
import turtle wn = turtle.Screen() wn.bgcolor("white") wn.title("List Practice") tess = turtle.Turtle() tess.pensize(5) def colouredSquare(sideLength,newColour): tess.color(newColour) for x in range(4): tess.forward(sideLength) tess.left(90) colourList=['red','green','blue','orange','hotpink','purple'] for eachColour in colourList: colouredSquare(75,eachColour) # Draw a square in the current colour. # The len() function will tell you how long a list is, or how many characters are in a string. # I'm using it here to calculate the angle I need, based on the size of the list. tess.left(360/len(colourList)) wn.mainloop()
See if you can use lists to help you create the shapes with different colours in task 4
Lets look at the learning outcomes and decide which one best describes our current level of understanding :
Tick the one you feel is closest to your level