Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

+

LearnIT
Python Coding
LESSON PLAN
School Grade Level
Teacher Learning Area Python Coding
Teaching Date and
Quarter
Time

Lesson Title: Modules


Suggested Time Allotment: 120 minutes
Suggested Number of Session/s: 2

I. OBJECTIVES
In this lesson, students will explore Python's extensibility using modules. We'll learn how to download them, import
them into our programs, and use their functionalities.

Specific Objectives:
After studying this lesson, the students should be able to:
1. explore built-in modules available in Python;
2. download and import modules; and
3. use modules to build programs.

ISTE Empowered Learner 1A-1B, Digital Citizen 2A-2D , Knowledge Constructor 3A-3D, Innovative
Standards: Designer 4A-4D, Computational Thinker 5A-5D,
CSTA 3A-CS-01, 3A-CS-02, 3A-1C-24, 3A-1C, Algorithms and Programming 3A-AP-13 – 3A-AP-23
Standards:
Values Integration:
1. Ability to think clearly and logically.
2. Longing to know and understand.
3. Independence of thought and flexibility of mind.
4. Awareness of the use of information technology skills in the world beyond the classroom.

II. SUBJECT MATTER


Content/Topic: Modules and Packages, Working with Modules and Packages
Concepts:
i. Understand and use Modules
ii. Work with modules and packages

III. LEARNING RESOURCES


Materials/Equipment:
i. Lesson 9 Modules PPT
ii. Laptop/Computer/Cellphone
iii. Pictures

References:
i. LearnIT – Python Coding Pages

Websites:
i.

IV. PROCEDURES

A. Reviewing previous lesson ELICIT


or presenting the new
The teacher will ask the students to show their assignments.
lesson
B. Establishing a purpose for
the lesson ENGAGE
The teacher plays Picture rebus with the students. The teacher will use the following picture
and the students will guest what word the picture is referring about in the game:

● for modules

C. Presenting
examples/instances of the ● for files
new lesson

● for directory

After the game, the teacher will ask the students to give meaning to the words used in the
game.

Use this as a springboard to the next lesson.


D. Discussing new concepts
and practicing new skills #1 EXPLORE
The Teacher will discuss and demonstrate the following:
Teachers Discussion Part 1
1. Modules and Packages
a. Creating Modules
b. Importing Modules
c. Installing Third-Party Packages
Note: Make sure that the students will do also all the examples that you’ve shown to them.

Practice Activity:
The Teacher will ask the students to try the following:
a. import math
dir(math)
*Explain that With the built-in function dir() and the name of the module as an
argument, you can list all valid attributes and methods for that module.
b. import math
cities = ["New York", "Toronto", "Berlin", "Washington", "Amsterdam",
"Hamburg"]
dir()
E. Discussing new concepts *Ask the students, what happen? Then explain the reason why the output is like
and practicing new skills #2 that, that’s because calling dir() without an argument, a list with the names in the
current local scope is returned:

c. import builtins
dir(builtins)
*displays all list of the Built-in functions, exceptions, and other objects by
importing the builtins module
Teachers Discussion Part 2
2. The Teacher will demonstrate how to work with Modules and PackagesDefining
Classes
a. Random
b. Turtle
c. Tkinter

Note: Make sure that the students will do also all the examples that you’ve shown to them.
EXPLAIN
F. Developing mastery (leads Hands-On
to Formative Assessment 3) 1. The teacher will ask the students to create their own Turtle.

G. Finding practical
applications of concepts
and skills in daily living
ELABORATE
1. The teacher will ask the students to tell something about the topic.
H. Making generalizations and 2. The Teacher will ask the students the student’s what kind of program they want to
abstractions about the create.
lesson

EVALUATE
STUDENT ACTIVITY 1:
The teacher will ask the students to Write code
1. Write code that will print random whole numbers from 2000 to 3000 that are divisible by
10.

I. Evaluating learning 2. Using the Turtle module, draw a right triangle with a base length of 20 pixels and a height
of 80 pixels.
3. Create an app that features a button that will change a text label's color every time it is
clicked. The colors can be: red, blue, black, yellow, orange, and green. Hint: The configure
method takes on foreground values e.g. "foreground='blue'". You can simply modify the
coin flipper app's code.

J. Additional activities for EXTEND


application or remediation The teacher will ask the students to create their own Tkinter.

V. REMARKS

Answer Keys
EVALUATE
Student Activity No. 1

1.
The code:

import random

print(random.randrange(2000, 3000, 10))

2. The code:

import turtle

ttl = turtle.Turtle()
ttl.forward(20)
ttl.left(104) # can be a close or an approximate value
ttl.forward(80)
ttl.left(166) # can be a close or an approximate value
ttl.forward(82.46) # can be a close or an approximate value

turtle.done()

3. The code:

from tkinter import *


import random

window = Tk()
window.geometry('200x80')
window.title('Change Colors')

title = Label(window, text='Change my color!', font=16)


title.pack(side='top')

def change():
  color = random.choice(['red', 'blue', 'black', 'yellow', 'orange', 'green'])
  title.configure(foreground=color)

button = Button(window, text='Change', command=change)


button.pack(side='top')

window.mainloop()

You might also like