Class 9 – Monday, September 14

Do that again

Did you not expect – The repetition to come – Did you not expect


Look both ways


Agenda


Downloads


To do list


Program kinda_stringy.py

Task

Realization

Two possible program runs

Enter a three-letter string: abc

a

b

c

Enter a string: am too

a

m

t

o

o

Enter a three-letter string: def

d

e

f

Enter a string: are not

a

r

e

n

o

t



Program wordy.py

Task

Realizations

Some program runs

Enter text: All hoos got your back

Supplied text = All hoos got your back

words = ['All', 'hoos', 'got', 'your', 'back']

All : 3

hoos : 4

got : 3

your : 4

back : 4

Enter text: It was a dark and stormy night

Supplied text = It was a dark and stormy night

words = ['It', 'was', 'a', 'dark', 'and', 'stormy', 'night']

It : 2

was : 3

a : 1

dark : 4

and : 3

stormy : 6

night : 5

Enter text:

Supplied text =

words = []



Program on_average.py

Task

Realizations

Two program runs

Enter text: over the hill and through the dale

Average word length: 4.0

Enter text: row row row your boat

Average word length: 3.4



Program again_and_again.py

Task

Realizations

Two possible program runs

Enter string to be printed: once again

Enter number of times to be printed: 3

once again

once again

Enter string to be printed: one more time

Enter number of times to be printed: 2

one more time

one more time



Program m_and_ns.py

Task

Realizations

Some program runs

Enter start and end: 2 6

2

3

4

5

6

Enter start and end: 4 7

4

5

6

7



Program n_and_ms.py — prints a user-specified downward interval of numbers

Realizations

Enter start and end: 5 1

5

4

3

2

0

Enter start and end: 12 11

12



Program inty.py

Task

Realization


I can smile, see

scary person

Schrödinger's cat

cat in a box

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.