Class 18 — Monday October 5

CSV Chrestomathics and logical values and decision

May the light of peace — For you and your families — Always shine brightly


Look both ways


Agenda


Downloads


To do


Program can_you_relate.py

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 logical_operators.py

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



Program acid_test.py

Three program runs

Enter pH level: 6.5

True

Enter pH level: 7.0

False

Enter pH level: 7.5

False



Next class


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


Dataset de jeur

ID, State, GWBD, Comment

AK, Alaska, Presidents' Day, 3rd Monday in February

AL, Alabama, George Washington-Thomas Jefferson Day, 3rd Monday in February

AR, Arkansas, George Washington's Birthday and Daisy Gatson Bates Day, 3rd Monday in February

AZ, Arizona, Lincoln-Washington-President's Day, 3rd Monday in February

CA, California, President's Day, 3rd Monday in February

CO, Colorado, Presidents' Day, 3rd Monday in February

CT, Connecticut, Washington's Birthday, 3rd Monday in February

DE, Delaware, No holiday observed, Non-applicable

FL, Florida, No holiday observed, Non-applicable

GA, Georgia, Washington's Birthday, Day before Christmas

....



Program what_day_is_it.py

Algorithm

Some sample program runs

Enter name of dataset: wdii.csv

Enter column of interest: GWBD

Enter column value of interest: No holiday observed

9

Enter name of dataset: wdii.csv

Enter column of interest: When

Enter column value of interest: 3rd Monday in February

38



Where am I

jpc @ stonehenge

Next class decision making

deciding which shoes to buy

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.