16: Procedures in python

Extend it:

Reuse sections of your code
Procedures in python: Reuse sections of your code

For this challenge you will need to define and call some of your own procedures

Challenges:

 
  1. Define a new procedure called draw_square

    Hint: Defining a procedure means telling python how to do something useful by giving a section of code a name. Use def to define your procedure

  2. Define a procedure called draw_triangle

    Hint: You will have to rotate by 120 degrees and draw a line three times to draw a triangle

  3. Call draw_square at least once

    Hint: Calling a procedure means telling python to actually run that named section of code. You need the name of the procedure followed by some brackets.

  4. Call draw_triangle at least once

    Hint: Calling a procedure means telling python to actually run that named section of code. You need the name of the procedure followed by some brackets.

2 thoughts on “16: Procedures in python

  • November 22, 2020 at 4:47 pm
    Permalink

    Hi there,

    Absolutely love your resources on programming and started using them today. Just wondering if there are solutions for the de-bugs on the programs here that pupils are supposed to de-bug. It will help me a lot so I can compare their answers with it.

    Reply
    • November 24, 2020 at 11:40 am
      Permalink

      Hello,
      Thanks so much for your message. I haven’t written up the answers yet – I’m trying go get through the full set of 20 activities then the next job will be to publish a student workbook and set of answers. Sorry not to help yet. Hope you’re well

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *