Class 28 — Wednesday October 28

Functionization

Social distancing — Does not mean we cannot share — Love, hopes, and friendship

I have a program — That will correctly predict — Election Winner

2020 I voted for president sticker

Look both ways


Agenda


Download at start of class


Post class


Homework


Function separate( s )

s1 = "apple"

s2 = "banana"

s3 = "1"

s4 = ""

separate( s1 ): ['a', 'p', 'p', 'l', 'e']

separate( s2 ): ['b', 'a', 'n', 'a', 'n', 'a']

separate( s3 ): ['1']

separate( s4 ): []


Function ints( ns )

bad1 = "abc"

bad2 = "3 def 4 ghi"

bad3 = "3.14"

ns1 = " 3 "

ns2 = "12 11 -63"

ns3 = "31 415 92 653 5 9"

ns4 = " "

ints( ns1 ): [3]

ints( ns2 ): [12, 11, -63]

ints( ns3 ): [31, 415, 92, 653, 5, 9]

ints( ns4 ): []


Function parse_phone_string( pn )

pn1 = "(201) 867-5309"

pn2 = "636-555-3226"

pn3 = "212 555 2368 (help line)"

pn4 = "888.799.9666 (customer service)"

parse_phone_string( pn1 ): [201, 867, 5309]

parse_phone_string( pn2 ): [636, 555, 3226]

parse_phone_string( pn3 ): [212, 555, 2368]

parse_phone_string( pn4 ): [888, 799, 9666]

Maria Saal Dom Grabbaurelief Reisewagen in die Unterwelt

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.