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

  • Cloud 9 Cheat Sheet
  • Lab - Using the Interpreter
  • Associated Reading - section 1.1 of Book
  • Ensure all students are able to log into the system
  • Go through the lab so that you are familiar with the requirements/results and can assist students

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 a photo of the Cloud9 IDE and asks students to identify the three key parts (file tree, terminal, editor) of the IDE.
    • After going over the three parts of the IDE have students check that they can still log into their IDE account.
  2. Lesson
    • The part on bottom half of the screen is called a console:
      • The console is a place where you can interact with a program. It can also be called a shell or a terminal.
      • The interpreter runs Python code.
    • To run the Python interpreter, type python3 into the terminal.
      • Go over the short cut/commands (ctrl-k, ctrl-c, ctrl-d) for the terminal that are listed on the Cloud 9 Cheat Sheet
      • 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, then pause to ask questions.
      • What does the // do? How is that different from /? And how are those different from %?
      • What’s the difference between 3.0 and 3?
      • Floats: a data type, number with a decimal point.
      • Integers: a data type, number without a decimal point.
    • Pause to ask questions about section 2.
      • What happened when you typed in a?
      • What do you think that error message mean?
      • String: a data type, characters surrounded in single or double quotes.
    • Pause to ask questions about 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!
    • Pause to ask questions about 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. How is it different than snap?

Accomodation/Differentiation

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