Class 19 – Friday October 11

Decisions made easy

I am positive — My favorite color is hue — Easy decision


Look both ways


Agenda


Problems


To do list


Expanded problem solving


Riddle me this — what classrooms are viable for scheduling CS 1112


Being logical

Three program runs

Enter number: 12

Enter number: 11

12 < 11 : False

12 > 11 : True

12 <= 11 : False

12 >= 11 : True

12 == 11 : False

12 != 11 : True

Enter number: 3

Enter number: 14

3 < 14 : True

3 > 14 : False

3 <= 14 : True

3 >= 14 : False

3 == 14 : False

3 != 14 : True

Enter number: 7

Enter number: 7

7 < 7 : False

7 > 7 : False

7 <= 7 : True

7 >= 7 : True

7 == 7 : True

7 != 7 : False


Program run

#### Logical values (bool)

True

False

##### Logical and

True and True = True

True and False = False

False and True = False

False and False = False

##### Logical or

True or True = True

True or False = True

False or True = True

False or False = False

##### Logical negation

not True = False

not False = True

##### Logical includes

1 in [3, 1, 4, 1, 5] = True

2 in [3, 1, 4, 1, 5] = False

##### Logical exclusion

1 not in [3, 1, 4, 1, 5] = False

2 not in [3, 1, 4, 1, 5] = True



Building a better chrysanthemum

Three program runs

Enter pH level: 6.5

True

Enter pH level: 7.0

False

Enter pH level: 7.5

False


Three program runs

Enter soil pH level: 6.5

pink

Enter soil pH level: 7

blue

Enter soil pH level: 7.5

blue


Program daisy_daisy.py

Seven program runs

Enter day of week: Sunday

weekend day

Enter day of week: monday

start of school week

Enter day of week: TUESDAY

school day

Enter day of week: Wednesday

school day

Enter day of week: Thursday

school day

Enter day of week: Friday

end of school week

Enter day of week: Saturday

weekend day


Program robotomy.py

Three program runs

class="coding">

Door (locked / unlocked): locked

Turn around

class="coding">

Door (locked / unlocked): Unlocked

Open the door

Light (on / off): on

Enter the room

Door (locked / unlocked): unlocked

Open the door

Light (on / off): Off

Turn on the light

Enter the room



deciding which shoes to buy


Chrysanthemum morifolium 08NOV; 池田正樹 (talk)masaki ikeda [Public domain]


Chrysanthemum Blue by Sugeesh at Malayalam Wikipedia [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)]


love is love celebration at the rotunda 2019

 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.