Students will be able to...
- Define and identify: comments, storing, mutability, variable assignment, input.
- Assign and swap variables.
- Store user input into a variable.
- 1.04 Slide Deck
- Do Now
- Lab - Magic Genie (docx)(pdf)
- Associated Readings 1.3
- Read through the Do Now, Lab, and lesson so that you are familiar with the requirements and can assist students.
- Video Resources:
Duration | Description |
---|---|
5 Minutes | Do Now |
20 Minutes | Continue Do Now & Discussion |
20 Minutes | Magic Genie Lab |
10 Minutes | Debrief/Quiz Prep |
- 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 may be given if the instructor feels it is necessary.
- Hold a discussion with students on
input
. - Discuss answers to the questions written in the Do Now.
- Explain that comments are not executed by the interpreter.
- 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)
- Define input: user data given to the app.
- Explain that in Python
input
lets a program take input from the console and use it in the code.
- 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?)
- Python 3 is strongly typed.
input
returns a string. - Demonstrate by typing in the following:
n = input()
9
type(n)
<class 'str'>
- 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.
- 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.
- 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?
- Review concepts so far: variables, interpreter, console, string, integer, float, run, output, variable swapping
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.