Class 28 — Wednesday October 28

Functionization

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


Look both ways


Download now


Check out Homework 25

Maria Saal Dom Grabbaurelief Reisewagen in die Unterwelt

Agenda


To Do


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 = "860+294+1986"

pn3 = "21 25 55 2368"

pn4 = "888.799.9666"

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

parse_phone_string( pn2 ): [860, 294, 1986]

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

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

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.