Class 20 — Frdiay February 28

Decisions made easy

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

Put cell phones away — Please do no multitasking — Or undertasking


Look both ways


Agenda


To do list


Examples


Last class (baby step) problem acid_test.py — building a better chrysanthemum

Some program runs

Enter pH level: 6.5

True

Enter pH level: 7.0

False

Enter pH level: 7.5

False



Expanded problem solving

if ( logical expression ) :

    action1

else :

    action2

No matter what only one of the two actions are executed.


Problem what_color_will_my_chrysanthemums_be.py

Some program runs

Enter soil pH level: 6.5

pink

Enter soil pH level: 7

blue

Enter soil pH level: 7.5

blue



Problem daisy_daisy.py

Some 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



Problem robotomy.py

Some program runs

Door (locked / unlocked): locked

Turn around

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



Problem who_is_the_longest_of_them_all.py

Some possible program runs

Enter text: Think before I act — My problem solving mantra — Make it your also

problem

Enter text: Remember always — Seek to be both great and good — The world needs your aid

Remember

Enter text:

 

Brainstorming

  • If it is the longest word we seen so far, then we need to remember it in order to compare it to the remaining words.
  • If it is not the longest word we seen so far, we take no further interest in it.


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)]



Where am I

love is love celebration at the rotunda 2019

 


 
  © 2020 Jim Cohoon   Resources from previous semesters are available.