Class 21 — Monday March 22

You are so controlling


Look both ways


Agenda


To do


Examples


For your consideration

Enter (yes / no): YES

yes

Enter (yes / no): No

no

Enter (yes / no): yeah

Enter (yes / no): yeap

Enter (yes / no): tá

Enter (yes / no): כן

Enter (yes / no): ndiyo

Enter (yes / no): haan

Enter (yes / no): YeS

yes

Enter (yes / no): nah

Enter (yes / no): không

Enter (yes / no): nope

Enter (yes / no): aʻole

Enter (yes / no): ei

Enter (yes / no): NO

no



Whiling away

while ( test expression ) :

  action

while ( test expression ) :

  action

else :

  action

looking_for_a_yes_or_no = True

while ( looking_for_a_yes_or_no == True ) :

  reply = input( 'Enter (yes / no): ' )

  reply = reply.lower()

  if ( reply in [ 'yes', 'no' ] ) :

  looking_for_a_yes_or_no = False

print( reply )



Problem yes_or_no.py


Problem guess_what.py


Problem robotomy.py

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




brainstorming - for rights see https://www.flickr.com/photos/99537327@N02/9472941659

 


  🦆 © 2022 Jim Cohoon   Resources from previous semesters are available.