Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Loopy Patterns

What am I Learning today?

I am learning how to use repetitions (loops) in python turtle and apply them in creating simple patterns.
I am learning how to use selection (if statement) in python turtle and apply it to conditionally execute blocks of code.
I am learning how to use python turtle to allow users to choose their own shapes and colours

Knowledge Organiser

×

Lesson

Task 1 - Getting Started Click to see more

You are going to screenshot all of your work into a Powerpoint file.

To download the PowerPoint by clicking on the image below

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


  • Complete Task 1 in your Powerpoint


  • Task 2 - A bit of background Click to see more

    Python Turtle changing the background


    Lets try the following tasks:

    Tick each task when you have successfully done it in the following list:

    Complete the following tasks

    Save your File as 'lesson2'
    Type the following:
    1. import turtle
    2. wn=turtle.Screen()
    3. wn.bgcolor('lightgreen')
    4. wn.title('Turtle Power')

    Run your lesson2 program


    It should look like this:


  • Screenshot your python code and output into your Powerpoint


  • Task 3 - Shell Shock Click to see more

    Creating Shapes

    • In the last lesson, you typed lots of repeated commands to create some shapes. This is enormously repetitive - it'd be much more convenient if we could instead find a way of repeating those instructions which would then also simplify our code."
    • Below is some python code see if you can work out what it does.
    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.color("green")
    tim.pensize(5)
    
    # Repeat the indented instructions 4 times.
    for myMoves in range(4): 
        tim.forward(100)
        tim.left(360/4) 
    
    # Wait until the window is closed.
    wn.mainloop()           
    
    • Note: Python is fussy about indentation. The two lines after the "for" command both need to be tabbed into the page. This lets Python know what instructions it is repeating, and which it isn't.

    • Lets try the following tasks:

      Tick each task when you have successfully done it in the following list:

      Complete the following tasks

      In Thonny, copy and paste the python code above
      Run your program


      • What shape was drawn?

    Review task:

    Tick each task when you have successfully done it in the following list:


    I can run the code in Thonny to draw a square.
    I can modify the code to draw a triangle.
    I can modify the code to draw a pentagon.


  • Screenshot your python code into your Powerpoint


  • Task 4 - User Input Click to see more

    User driven shapes:

  • We have so far drawn our shapes by typing the commands into python, but what if we want the user to decide how big the shape will be?
  • Below is some python code see if you can work out what it does.
  • 
    #ask the user to input the size of our shape
    size=int(input("What size lines would you like? "))
    
    # Repeat the indented instructions 3 times.
    for myMoves in range(3):
        tim.forward(size)
        tim.left(360/3)  
    
    
              
    
    Lets try the following tasks:

    Tick each task when you have successfully done it in the following list:

    Complete the following tasks

    Add the above your code, to your shapes file so it appears above the 'for myMoves in range(4):' line:
    Run your program by hitting F5.


    Extension task:

    Tick each extension task when you have completed it in the following list:


    I can write code to ask what pen thickness (pensize) the user would like, and set the line to that thickness too.
    I can write code to ask what the colour of the shape drawn should be and make the shape that colour.

    Example


    Summing it all up

    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

    Learning Outcomes I need to learn how to use repetitions (loops) in python turtle and apply them in creating simple patterns.

    • I have a basic understanding of how I can use repetitions (loops) in python turtle and apply them in creating simple patterns. with a little help from my teacher
    • I can show my teacher that I can use repetitions (loops) in python turtle and apply them in creating simple patterns. without their help.
    • I can use repetitions (loops) in python turtle and apply them in creating simple patterns. independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image


    Task 5 - What IF? Click to see more

    • Look at the pattern below see if you can recreate it using the code you have learned so far.
    • We can do this by using loops.
    ?>
  • Screenshot your python code into your Powerpoint


  • Task 6 - Let's review it Click to see more

    Summing it all up

    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

    Learning Outcomes I need to learn how to use selection (if statement) in python turtle and apply it to conditionally execute blocks of code.

    • I have a basic understanding of how I can use selection (if statement) in python turtle and apply it to conditionally execute blocks of code. with a little help from my teacher
    • I can show my teacher that I can use selection (if statement) in python turtle and apply it to conditionally execute blocks of code. without their help.
    • I can use selection (if statement) in python turtle and apply it to conditionally execute blocks of code. independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image


    Task 7 - Extension Click to see more

    Create a shape drawing program that asks the user to enter different information to create their own shape:

  • The user enters the number of sides, a colour and a size.
  • Your code draws the correct shape the correct size with the correct colour.

  • Screenshot your python code into your Powerpoint


  • Task 8 - Lesson review/Homework Click to see more

    Complete the review slide below for Homework


    Summing it all up

    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

    Learning Outcomes I need to learn how to use python turtle to allow users to choose their own shapes and colours

    • I have a basic understanding of how I can use python turtle to allow users to choose their own shapes and colours with a little help from my teacher
    • I can show my teacher that I can use python turtle to allow users to choose their own shapes and colours without their help.
    • I can use python turtle to allow users to choose their own shapes and colours independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image

    My Notes: Coding_Turtle

    Student_Comment_1 not found

    Task Notes/Comments - Add here Click to see more

    Comments/Notes

    Copyright © 2013 - 2025 LearnITwithMrC