Class 20 — Friday, October 8

You are so controlling

  • While I can go on – I do not repeat myself – Always a new way

Look both ways


Joke of the day

shampoo noun project #:4235548

Agenda


To do


Examples


Problem arrangements.py

  • The start value is m; the stop value is less than n; and the other values go up in steps of k
  • The start value is m; the stop value is greater than n; and the other values go down in steps of k

Enter integers m, n, and k: 3 8 2

i: 3

i: 5

i: 7

list( range( m, n, k ) ): [3, 5, 7]

Enter integers m, n, and k: 10 6 -3

i: 10

i: 7

list( range( m, n, k ) ): [10, 7]



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



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