Lesson Plan
Python Power Up!
Students will be able to write and run a simple Python program using print statements and variables to display text.
Understanding basic coding principles like print statements and variables is crucial for developing computational thinking and problem-solving skills, which are valuable in many aspects of life, not just computer science.
Audience
7th Grade Students
Time
30 minutes
Approach
Interactive slides, guided coding activity, and a quick challenge.
Materials
Python Power Up! Slide Deck, Python Power Up! Script, Hello, Python! Warm Up, Print & Play Python! Activity, and Print & Play Python! Answer Key
Prep
Preparation Steps
15 minutes
- Review the Python Power Up! Slide Deck and Python Power Up! Script.
- Ensure all students have access to an online Python interpreter (e.g., replit.com, trinket.io, or a similar browser-based environment).
- Make sure the Print & Play Python! Activity and Print & Play Python! Answer Key are ready for distribution or display.
- Test the online Python interpreter on a classroom computer to ensure functionality and accessibility for students.
Step 1
Warm Up: Hello, Python!
5 minutes
Begin with the Hello, Python! Warm Up to activate prior knowledge about programming and pique student interest. Display the warm-up questions on the board or distribute them. Engage students in a brief discussion about their initial thoughts on coding.
Step 2
Introduction to Python
10 minutes
Use the Python Power Up! Slide Deck and Python Power Up! Script to introduce Python. Focus on:
- What is Python?
- Basic print() function syntax.
- What are variables and how to assign values to them.
- Demonstrate simple examples of print() and variables in the online interpreter.
Step 3
Activity: Print & Play Python!
10 minutes
Distribute the Print & Play Python! Activity. Guide students through the activity, encouraging them to experiment with print() statements and variables in their online Python interpreter. Circulate around the room to offer support and answer questions. Remind them to refer to the slides if they get stuck.
Step 4
Wrap Up & Share
5 minutes
Bring the class back together. Ask students to share one interesting thing they learned or created during the activity. Briefly review the key concepts of print() and variables. Collect or review completed activities. Provide the Print & Play Python! Answer Key for self-assessment or future review.
use Lenny to create lessons.
No credit card needed
Slide Deck
Python Power Up!
Get Ready to Code!
Welcome students and get them ready for a fun introduction to Python. Briefly introduce yourself and the goal of the lesson.
What is Python?
- A coding language that tells computers what to do!
- Used by companies like Google, NASA, and Instagram.
- Great for beginners because it's easy to read.
- We'll learn the very basics today!
Introduce Python as a language. Emphasize that it's used for many cool things they might recognize.
First Command: print()
print("Hello, world!")
- The
print()command tells Python to display something on the screen. - Whatever you want to print goes inside the parentheses
()and quotation marks"".
What do you think this will print?
print("My name is [Your Name]")
Explain the print() function simply. Show an example and have students think about what it will do.
Storing Information: Variables
name = "Lenny"
- A variable is like a box that holds information.
- You give the box a name (the variable name).
- You put information (the value) inside using the equals sign
=.
Example:
favorite_color = "blue"
print(favorite_color)
What will this print?
Introduce variables. Explain them as containers for information. Provide simple examples.
Putting It Together!
student_name = "Alex"
age = 12
print("Hello, ")
print(student_name)
print("You are ", age, " years old.")
What will the output of this code be?
Introduce a slightly more complex example combining print and variables. Encourage discussion.
Your Turn! Print & Play!
- You'll get an Print & Play Python! Activity sheet.
- Open your online Python interpreter (e.g., replit.com).
- Follow the instructions to write your own Python code.
- Experiment, have fun, and don't be afraid to make mistakes!
Explain the activity and how to access the online interpreter. Remind them it's okay to make mistakes.
You're a Python Coder!
- Today, you learned to use
print()and variables. - You wrote your first Python code!
- Coding helps us solve problems and create amazing things.
What was your favorite part?
Conclude the lesson by asking students to share and summarizing the key takeaways.
Script
Python Power Up! Script
Warm Up: Hello, Python! (5 minutes)
(Display Hello, Python! Warm Up questions)
"Good morning/afternoon, everyone! Today, we're going on an exciting adventure into the world of computer programming. Before we dive in, let's get our brains warmed up. Take a look at these questions on the screen (or on your sheet) and think about them for a moment. What comes to mind when you hear the word 'coding'? What do you think a computer program is?"
"Okay, who would like to share their thoughts? Is anyone familiar with coding or programming? No worries if not, that's what we're here to learn!"
(Facilitate a brief discussion, acknowledging all answers.)
"Great ideas, everyone! Many of you mentioned giving instructions to a computer, and that's exactly what coding is about. It's like teaching a computer a new language so it can understand what we want it to do."
Introduction to Python (10 minutes)
(Advance to Python Power Up! Slide Deck - Slide 2: What is Python?)
"The language we're going to learn today is called Python! Has anyone heard of Python before?"
(Pause for responses.)
"Python is super cool because it's used by huge companies like Google and Instagram, and even NASA for space missions! It's also fantastic for beginners because it's designed to be easy to read and understand, almost like regular English. Today, we're going to learn just two foundational concepts to get us started."
(Advance to Python Power Up! Slide Deck - Slide 3: First Command: print())
"Our very first command in Python is print(). What do you think print() does?"
(Pause for responses.)
"That's right! The print() command tells the computer to display something on the screen. It's how our program talks to us. Look at the example on the slide: print("Hello, world!"). Notice how 'Hello, world!' is inside parentheses and quotation marks? That's important! Whatever you want Python to literally show on the screen needs to be in those quotes."
"Now, if I wrote print("My name is [Your Name]"), what do you think would appear on the screen?"
(Call on a student or two.)
"Exactly! It would display 'My name is [Your Name]'. The computer prints exactly what's inside those quotes. Let's try it out!"
(Open the online Python interpreter on the projector.)
"Everyone, please open an online Python interpreter on your devices. I recommend replit.com or trinket.io. Once you're there, type in print("Hello, class!") and press run. What happens?"
(Give students a moment to try, offer help as needed.)
(Advance to Python Power Up! Slide Deck - Slide 4: Storing Information: Variables)
"Now, let's learn about something called a variable. A variable is like a box that holds information. You give the box a name, and then you put something inside it. We use an equals sign = to put information into our variable."
"For example, if I write favorite_color = "blue", I've created a 'box' named favorite_color and put the word 'blue' inside it. Now, if I then type print(favorite_color), what do you think will happen? This time, notice there are no quotation marks around favorite_color when we print it."
(Call on a student.)
"That's a great thought! Since favorite_color is a variable, Python knows to look inside that 'box' and print whatever is stored there. So, it would print 'blue'. Let's see this in action!"
(Demonstrate in the online interpreter: my_name = "[Your Name]", then print(my_name).)
"See how it printed the name I stored? The computer knows that my_name refers to 'Lenny'."
(Advance to Python Power Up! Slide Deck - Slide 5: Putting It Together!)
"Let's combine these ideas. Look at the code on the slide. We've created two variables: student_name and age. Then we use print() a few times. Take a moment to read through it and predict what the output will be."
(Give students a moment to think or discuss with a neighbor. Then call on a student to explain.)
"Excellent! It will print 'Hello,' on one line, then 'Alex' on the next, and finally 'You are 12 years old.' on the third line. Python executes the commands one by one, from top to bottom. Notice how we can combine text in quotes with variables when we print, using commas in between."
Activity: Print & Play Python! (10 minutes)
(Advance to Python Power Up! Slide Deck - Slide 6: Your Turn! Print & Play!)
"Now it's your turn to be the Python programmer! I'm going to hand out the Print & Play Python! Activity sheet. Your task is to open your online Python interpreter and follow the instructions on the sheet. You'll be using print() and variables to create your own messages."
"Remember, coding is about experimenting. Don't be afraid to try things out and make mistakes; that's how we learn! If you get stuck, look back at our slides, or ask a neighbor. I'll be walking around to help out."
(Distribute the Print & Play Python! Activity and circulate, providing individual support.)
Wrap Up & Share (5 minutes)
(Advance to Python Power Up! Slide Deck - Slide 7: You're a Python Coder!)
"Alright everyone, let's bring it back together. Great job tackling your first Python challenges!"
"Can anyone share one interesting thing they printed or a variable they created during the activity?"
(Allow a few students to share their creations or discoveries.)
"Fantastic! Today you learned how to use the print() command to make your computer display messages, and you learned how to use variables to store information. These are fundamental building blocks in programming, and you've just built your very first Python creations! Give yourselves a pat on the back."
"You've taken a huge first step into computational thinking and problem-solving through code. Keep exploring, and you'll be amazed at what you can create!"
(Collect activity sheets or instruct students on where to submit them. Hand out or display the Print & Play Python! Answer Key for review.)
Warm Up
Hello, Python! Warm Up
Take a few minutes to think about these questions. We'll discuss them as a class.
- What do you think of when you hear the word "coding" or "programming"?
- What do you think a "computer program" is?
- Have you ever used an app or played a game and wondered how it was made?
Activity
Print & Play Python! Activity
Instructions: Open your online Python interpreter (like replit.com or trinket.io). Follow the steps below to write your own Python code!
Part 1: Your First Prints!
-
Greeting the World!
Write aprint()statement that says "Hello, world!"# Type your code here: -
Your Name!
Write aprint()statement that displays your own name.# Type your code here: -
Your Favorite Food!
Write aprint()statement that tells us your favorite food.# Type your code here:
Part 2: Variable Adventures!
-
Store Your Name
Create a variable calledmy_nameand store your name (as text) inside it. Then,print()yourmy_namevariable.# Type your code here: -
Store Your Age
Create a variable calledmy_ageand store your age (as a number) inside it. Then,print()yourmy_agevariable.# Type your code here: -
Combine & Print!
Now, let's combine text and variables! Write aprint()statement that says:
"Hi, my name is [your name variable] and I am [your age variable] years old!"Hint: Remember to use commas to separate text in quotes from your variables.
# Example: # my_town = "Smallville" # print("I live in ", my_town) # Type your code here:
Challenge (Optional):
Create two new variables: favorite_animal and animal_sound. Store your favorite animal and the sound it makes in these variables. Then, write print() statements to tell us your favorite animal and the sound it makes!
Example Output:
My favorite animal is a dog.
A dog says Woof!
# Type your challenge code here:
Answer Key
Print & Play Python! Answer Key
Note: Student answers for names, ages, and favorite foods will vary. The examples below show the correct structure and expected output.
Part 1: Your First Prints!
-
Greeting the World!
print("Hello, world!")Expected Output:
Hello, world! -
Your Name!
print("Alice Smith") # Replace with student's nameExpected Output:
Alice Smith(or similar, with student's name) -
Your Favorite Food!
print("My favorite food is pizza.") # Replace with student's foodExpected Output:
My favorite food is pizza.(or similar, with student's food)
Part 2: Variable Adventures!
-
Store Your Name
my_name = "Alice Smith" print(my_name)Expected Output:
Alice Smith(or similar, with student's name) -
Store Your Age
my_age = 12 print(my_age)Expected Output:
12(or similar, with student's age) -
Combine & Print!
my_name = "Alice Smith" my_age = 12 print("Hi, my name is ", my_name, " and I am ", my_age, " years old!")Expected Output:
Hi, my name is Alice Smith and I am 12 years old!(with student's info)
Challenge (Optional) Answer:
favorite_animal = "dog"
animal_sound = "Woof!"
print("My favorite animal is a ", favorite_animal, ".")
print("A ", favorite_animal, " says ", animal_sound)
*Expected Output:
My favorite animal is a dog.
A dog says Woof!
(Outputs will vary based on student's chosen animal and sound.)