1 of 31

2 of 31

DO NOW

Complete the classroom scavenger hunt worksheet based on your observations.

3 of 31

VARIABLES

IN

PYTHON

4 of 31

Lesson Goals

UNDERSTAND THE PURPOSE OF VARIABLES

MASTER VARIABLE DECLARATION AND INITIALIZATION

CREATE VARIABLES IN PYTHON

1

2

3

5 of 31

SCAVENGER HUNT REVIEW

DO NOW

6 of 31

Scavenger Hunt Review

7 of 31

What is a variable?

8 of 31

9 of 31

DECLARING VARIABLES

10 of 31

11 of 31

Rules for declaring variables

12 of 31

Begin with a letter or underscore�

Letters, numbers, or underscores

Spaces

  • Special Characters

Rules for declaring variables

13 of 31

BE�DESCRIPTIVE

14 of 31

car_color

15 of 31

address@school!

16 of 31

a1

17 of 31

Scavenger Hunt

TURN & TALK

INSTRUCTIONS

  • Discuss possible variable names for the scavenger hunt items

EXTENSIONS

  • Finished early? See if you notice any similarities in the types of data each variable might hold.

Item

Number of Chairs

Color of a backpack

Electronic Devices

Number of Windows

18 of 31

number_of_pencils

8

19 of 31

PyCharm

20 of 31

21 of 31

22 of 31

23 of 31

Right tool

for the

right job

24 of 31

Create Variables

PARTNER ACTIVITY

INSTRUCTIONS

  • Declare and initialize the items from the Scavenger Hunt on the worksheet.
  • Open our inclass.py file and declare and initialize the variables.

EXTENSIONS

  • Print the variables to the console.
  • Add a text label before printing the value to the console.
  • Create a simple Madlib. Create a list of variables and use those variables, combined with text, to make a silly sentence or nursery rhyme.

25 of 31

Variables are named storage locations that hold data.

Variables have rules for declaring them.

After a variable is initialized, it holds a value.

SUMMARY

26 of 31

inclass.py

27 of 31

inclass.py

Extension 1

28 of 31

inclass.py

Extension 2

29 of 31

madlib.py

Extension 3

30 of 31

WRAP UP

  • Save the inclass.py file.
  • Complete the wrap-up question and self assessment.
  • Return laptops to charging cart.
  • Submit the worksheet.
  • Smile and celebrate your accomplishments! Nice work!

31 of 31

917.359.1996

www.teachCS.info

CONTACT US

The information contained in these documents is confidential, privileged and only for the information of the intended recipient and may not be used, published or redistributed without the prior written consent of TeachCS LLC.