Python 101 - Lesson 8

Python 101 - Lesson 8

11-13 yrs old

14-18 yrs old

Computer Science



avatar Submitted By: Minecraft Education

November 11, 2020


  • Creativity
  • Critical Thinking

Learning Objectives

  • Create programs that include sequences, events, loops, and conditionals. 1B-AP-10
  • Create procedures with parameters to organize code and make it easier to reuse. 2-AP-14
  • Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process. 1B-AP-11

Guiding Ideas

In this lesson the students will learn:

- the concept of functions.

- how to use functions.

- how to create their own functions.

- the concept of in code comments.

- to use comments.

Tell the students that they need to help to increase the capabilities of the Agent. CodingMine wants to develop the Agent to help an ecological organization. This organization wants to plant a large number of trees and they must do it very quickly as they have a deadline. However, it is not an easy job to prepare the soil to plant pastures of saplings. That is why the organization wants to use the Agent, but the developers have been having some problems with their code.

Student Activities

Coding Concepts:

- Functions

- Comments

Coding activities: (30 min)

1. Activity 1: One row at a time

Explain to the students that the developer needs their help to code the Agent to till, plant and fertilize a row of trees in their planting spots. (Hint: Explain to the students that tilling means to ‘prepare a piece of soil’ for planting). Explain to the students that, as the spaces in between the planting spots are not identical, they cannot use a simple for loop. Tell the students that the best way to complete this Activity is by making a function with the sequence of actions that the Agent must make.

2. Activity 2: Breaking boulders

Explain to the students that the next developer needs their help to code the Agent to clear the ground of rocks and then till and plant saplings in their planting spots. Explain to the students that they will now need to use more complex pieces of code with their functions.

3. Activity 3: Pasture of trees

Tell the students that the next developer needs their help to code the Agent to move across a large area and plant saplings only on the grass blocks. Explain to the students that to make the Agent move, pass over every block in an area that would, up until now, have used a nested loop, but this is no longer necessary as we can do the same action using functions.

Performance Expectations

Ask the students about the skills that they have learned during the lesson, to reinforce the concepts.

Q. What is a function?

A.  A function is a command you can create that can run a group of other commands, or any piece of code, when called.

Q. Why are functions useful?

A. Functions are a great way to shorten repetitive code and make it more organized.

Q. What are comments?

A. Comments are pieces of text, useful for the developer, inserted in a code that the computer does not run.

Q. How do you write a comment?

A. Comments are written by placing a # before the text.




  • Creativity
  • Critical Thinking