Compsci 101 101 Introductio ion Live L Lectu ture re Susan Rodger sum(lst) sum of the elements in lst September 8, 2020 maximum value of lst max(lst) min(lst) minimum value of lst .append(elm) Mutates the list by adding elm to the end of the list .count(elm) Number of times see elm in the list 9/8/2020 Compsci 101, Fall 2020 1
Announcements • Assig ignm nment nt 1 Totem em d due Thur Thur, S Sep ept 10, 10, 11:30 11:30pm • Also REFLECT Form due same time • APT APT-2 o 2 out t today, , due ue Tue ue, S Sep ept 15 15 • Extens nsio ion f n form o on the course w e websit ite. (Forms rms t tab) • Sickness or Athlete traveling • Sick, must fill out incapacitation form • Exam am in in ab about ut t two w week eeks • Send in SDAO letter now 9/8/2020 Compsci 101, Fall 2020 2
PFTD • Lists c continued inued • String ing m metho hods a and m more 9/8/2020 Compsci 101, Fall 2020 3
WOTO-1 Cloning http://bit.ly/101f20-0908-1 • In In you our g grou oups: • Come to a consensus 9/8/2020 Compsci 101, Fall 2020 4
WOTO-2 – Mutable http://bit.ly/101f20-0908-2 • If you u ar are d e done ear ne early, t thi hink ab about t the m he mud uddiest point int s so far ar and and a ask m me e or on n Pia iazza • In In you our g grou oups: • Come to a consensus 9/8/2020 Compsci 101, Fall 2020 5
WOTO-3– List Append http://bit.ly/101f20-0908-3 • Try d drawing it it out ut if if you u ar aren en’t s sur ure! • In In you our g grou oups: • Come to a consensus 9/8/2020 Compsci 101, Fall 2020 6
WOTO-4 – Split and Join http://bit.ly/101f20-0908-4 • If you a u are d e done ne early, think nk o of the m e muddies est p point nt and ask sk me me or or on on P Piazza! • In your ur g group ups: • Come to a consensus 9/8/2020 Compsci 101, Fall 2020 7
More Methods Stri St ring List .find(s) index of first sum(lst) sum of the elements occurrence of s in lst .rfind(s) index of last occurrence max(lst) maximum value of lst of s (from Right) minimum value of lst min(lst) .upper()/ uppercase/lowercase Mutates the list by .append(elm) .lower() version of string adding elm to the end .strip() remove leading/trailing of the list whitespace Number of times see .count(elm) .count(s) number of times see s in string elm in the list .startswidth(s) bool of whether the string begins with s .endswidth(s) bool of whether the string ends with s 9/8/2020 Compsci 101, Fall 2020 8
Recommend
More recommend