Getting Started (5min)

Write a reflection on the homework from last class to write code to introduce yourself. The program should:
 Display your name.
 Greet and ask for three interests.
 Display the three interests
 Give a reply like "That's interesting!"
Did you run into any errors?
Do you feel that you can easily write this kind of code?
Share results with an elbow partner.
Teacher Note: Ideally, students are paired with people they don't work with as frequently, in order to promote classroom culture.
Introduction of Content (10 min)
Refer to the PowerPoint called Values and Types in the Lesson Resources folder.
 Value:
 Everything on a computer reduces to numbers
 Letters are represented by numbers (ASCII codes)
 Pixel colors are represented using three numbers (red, green, blue)
 Python tells these numbers apart by the use of types
 Type:
 A set of values and the operations performed on them
 Examples of operations: +, , /, *
 The meaning of these depends on the type!
 Integers (ints):
 Values: ... 3, 2, 1,0,1,2,3,4
 Integer literals have no commas (1, 2, 10, 1034453)
 Operations: +, , * (multiply), /, ** (to the power of)
 Floating point (float):
 Values: (approximations of) real numbers
 In Python, a number with a
'.'
is a float (ie. 2.0)
 Without a decimal, a number is an int (ie. 2)
 Operations: +, , * (multiply), /, ** (to the power of)
 Exponential notation is useful!
Check for Understanding: Have students write an integer on their paper (check with their elbow partner that it is a number). Ask students to turn that integer into a float with the same numerical value. Talk about going the opposite direction (float to int).
(Example answers: int: 3 float: 3.0 or 3.00 or ...)
 String (str):
 Values: Any sequence of characters within double or single quotes
 Operations: + (referred to as catenation or concatenation)
 Concatenation can only apply to strings
"hello"
+ "world"
= "helloworld"
"hello"
+ " world"
= "hello world"
"hello"
+ 2 produces an error
 Boolean (bool) :
 Values: True, False
 Boolean literals are just
True
and False
(they must be capitalized!)
 Operations: not, and, or
 not b: True if b is False and False if b is True
 b and c: True if both b and c are True; False otherwise
 b or c: True if b is True or c is True; False otherwise
 Check for Understanding: Hold up two objects for the students to see, then ask the following questions:
 I am holding object A and object B. True or False?
 Drop one of the objects. I am holding object A and object B. True or False?
 I am holding object A or object B. True or False?
 Often comes from comparing int or float values
 Order comparison:
i< j
i<=j
i>=j
i>j
 Equality, inequality:
i == j
i!= j
('='
means something else!)
Guided Activity: Type Sort (15 min)
 Group students (see differentiation for grouping options).
 Ask teams of students to group the values by types.
Teacher Note: See Differentiation for two variations of this activity.
Individual Activity (15 min)
Studens will complete the Exploration Worksheet which is found in the Lesson Resources folder.
 Version 1:
 Hand out exploration worksheet and allow students to work individually on their computer in PyCharm IDE or terminal/command.
 Make sure students are filling in their expected value before determining the calculated value. They need only fill in the "reason for calculated value" if their two values do not match originally.
 Version 2:
 If a student needs a little more practice before moving on, send them to the Runestone to complete the Variables and Expressions activity before releasing them to the exploration:
http://interactivepython.org/runestone/static/thinkcspy/SimplePythonData/simpledata.html#valuesanddatatypes
Wrap Up (5 min)
 Exit ticket: Give the value of the Python expression. Also give the name of the operator used.
2 + 5
5 * 2
5 ** 2
5 / 2
5 % 2
5 + 2 * 4
5 * 2  3
 Which of the following Python expressions give an error in Python?
"pay attention to details'
' " what's for lunch?", my partner asked'
"What's for lunch?", my partner asked"
Ideas for grouping students:
 Team Shake App A simple app that allows you to put in your students, decide the number of "teams", and randomly groups students. It will allow you to balance teams based on skill or gender, and will allow you to share teams via facebook or email.
 Require students to go find other people in the room and give them a highfive. They may not highfive the person next to them.
 Group by birthday month (make adjustments to the groups as needed)
 Number off
 Ask students to count up the letters in their first name and determine if they have an odd number of letters or an even number of letters. Find three or four others who also have an even or odd number of letters in their name and form a group.
 Variation if you have talked about other number systems: Find the number of letters mod the number of groups you need.
Group Activity Variations:
 Give the students a large piece of colored paper and a glue stick, and allow them to glue the types together for later use in the classroom.
 Create small, individual sets of cards, and have them glue the cards in to their journals by type.
 Create multiple sets of values. Hand all groups the first set of values and allow them to organize the values by type. For the remaining sets, have groups compete against one another to see who can sort the values the fastest.
 Print out Bingo cards of values ahead of time and call for: an integer less than 10 and greater than 5, a String with 3 letters, etc. http://www.teachnology.com/web_tools/materials/bingo/5/