CAS CS 111 Lecture Notes - Lecture 9: 5,6,7,8, Boolean Expression, List Comprehension
cherryberry1035 and 38883 others unlocked
48
CAS CS 111 Full Course Notes
Verified Note
48 documents
Document Summary
He then tells the person behind him that he is the first, and then that person take the number and plus one then pass it back until it reaches you. >>> 30 map(function, sequence) take a list of values and apply them to the function. list(map(triple, python")) [ python", python", python"] list turn into a list for me. [ ppp", yyy" , , nnn"] list comprehension with boolean expressions. [expression for variable in sequence if boolean] boolean expression means something that gives you true or false. [1 for x in [4, 5, 6, 7, 8] if x % 4 == 0] 1, 1 sum([1 for x in [4, 5, 6, 7, 8] if x % 4 == 0]) 2 how many things in the list meet a certain criteria when combining sum and list comprehension using the expression of [1 for ]