Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 3.92 KB

File metadata and controls

102 lines (71 loc) · 3.92 KB

Lesson 1.02: Interactive mode

Learning objectives

Students will be able to...

  • Define and identify: interpreter, string, integer, float, value, errors, console, expression.
  • Use the Python interpreter to evaluate simple math expressions.
  • Distinguish between an integer, float, and string.

Materials/Preparation

Pacing guide

Duration Description
5 Minutes Do Now
10 Minutes Lesson
15 Minutes Lab Part 1/Discussion
20 Minutes Lab Part 2/Discussion
5 Minutes Debrief

Instructor's notes

1. Do now

  • Display the IDE and asks students to identify the key parts (menu bar items [run, console, +], code panel, console panel).
  • After going over the three parts of the IDE have students check that they can still log into their IDE account.

2. Lesson

Guided activity

  • Have students all bring up their console on their computer.
  • The part on right half of the screen is called a console:
  • The console is a place where you can interact with a program.
  • The interpreter runs Python code.
  • To run the Python interpreter, type code into the console and hit "Enter" or click "Run", the code executes immediately.
  • Make sure all the students are able to do this and then give out the lab worksheet.

3. Lab part 1

Give students time to work on section 1.

Discussion section 1

  • What does the // do? How is that different from /? And how are those different from %?
  • What's the difference between 3.0 and 3?
  • Go over the following two terms:
    1. Floats: a data type, number with a decimal point.
    2. Integers: a data type, number without a decimal point.
  • Now, give students time to work on section 2.

Discussion section 2

  • What happened when you typed in a?
  • What do you think that error message mean?
  • Go over String: a data type, characters surrounded in single or double quotes.
  • Now, give students time to work on section 3.

Discussion section 3

  • What was the difference between the two inputs?
  • Strings can be combined using +.
  • What do you think the error message means?
  • You can't combine different types!
  • Now, give students time to work on section 4.

Discussion section 4

  • What error did you get? What do you think that means?
  • What happens when you multiply strings?

4. Lab part 2

  • Define expression: a combination of values and operators (and variables)
  • Ask students to give an example of an expression.
  • Make sure students write down their predictions before going to the interpreter/IDE to check the actual output.

5. Debrief

  • Discuss any surprising/unexpected results.
  • Remind students of adding strings together using +.
  • Talk about how single and double quotes are interchangeable.
  • Multiplying strings.
  • Order of Operations is the same as what students have learned in math class.
  • Discuss why it might be helpful to have an interactive console.

Accommodation/differentiation

If students are moving quickly, have students practice higher order-of-operations problems. You can also have them practice assigning values to variables.