Lesson Plan 1.04: Variables and User Input
Learning Objectives
Students will be able to...
- Define and identify: comments, storing, mutability, variable assignment, input
- Assign and swap variables
- Store user input into a variable
Materials/Preparation
- Do Now
- Lab - Magic Genie
- Read through the Do Now, Lab, and lesson so that you are familiar with the requirements and can assist students
Pacing Guide
Duration | Description |
---|---|
5 Minutes | Do Now |
20 Minutes | Continue Do Now & Discussion |
20 Minutes | Magic Genie Lab |
10 Minutes | Debrief/Quiz Prep |
Instructor's Notes
- Do Now
- Project the Do Now on the board, circulate around the class to check that students are working and understand the instructions. Only allow 5 minutes. Additional time will be given to complete
- Do Now Work & Discussion
- Input Discussion
- Discuss answers to the questions written in the Do Now.
- Explain that comments are not executed by the interpreter
- Discussion Questions:
- What did
input
do? - What did the string between the parentheses do?
- What would changing that string do? (it changes the prompt given to the user)
- What did
- Define input: user data given to the app.
- Explain that in Python
input
lets a program take input from the terminal and use it in the code. Recall using input from snap. - Display on the screen:
- Ask students what things from Python they will need to create this program.
- Ask students to take 3 minutes to convert this to Python.
- Call some students up to write their answers on the board.
- Practice changing the argument to input function in class. (ex. How would you have the computer ask what month the students were born in?)
- Swapping Variables Discussion
- Provide students with additional time to work on this portion of the Do Now worksheet.
- Discuss student results.
- Have students write answers on the board, or call on students to give you answers line by line and you write the code on board or type out.
- Discuss the idea of setting variables to be other values.
- What would happen if you don’t store a into c in this program?
- Mutability: you can change an existing value
- Input Discussion
- Magic Genie Lab
- Make sure students feel comfortable saving things as variables and can print multiple things.
- Troubleshoot with students and try to recognize early which students are struggling.
- Debrief/Quiz Prep
- Discuss any issues that came up in the magic genie program.
- Were there any error messages? What do they mean?
- Did anyone use more than one variable?
- Let students know about
- Review concepts so far: variables, interpreter, terminal, string, integer, float, run, output, variable swapping
- Discuss any issues that came up in the magic genie program.
Accomodation/Differentiation
Advanced students that are finished early can be paired with students who are struggling. Be careful to give clear guidance about how to effectively help another student, especially emphasizing that helping never involves using someone else's keyboard/mouse.
Identify students that may potentially struggle on the quiz and find individual time with them to emphasize key concepts during the magic genie lab.