QUESTION 1 (28 pts) ========== s[5:8] 'PRO' 2 in s False s[values[3]] '2' s.split('A') ['H','VE2PROGR','M'] [1,2]*2 [1,2,1,2] not len(s) in values True values.index(4) 3 values.index(2) 0 +4 for correct answer (+2 if they omit string quotes but have correct answer) QUESTION 2 (20 pts) ========== +4 def checkList(myList): +2 """count times 'b' appears right after 'a'""" +1 count = 0 +2 +1 +1 for idx in range(len(myList)-1): +2 +1 +1 +1 +1 if myList[idx] == 'a' and myList[idx+1] == 'b': +1 count += 1 +2 return (count) def +1 checkList +1 (myList) +1 : +1 """doc""" +2 count=0 +1 for +2 range +1 len(myList)-1 +1 if +2 myList[idx]=='a' +1 and (or nested) +1 myList[idx+1]=='b' +1 : +1 count += 1 +1 return (count) +2 QUESTION 3 (20 pts) ========== +4 def uniqueValues(d): +2 """Return list containing unique values""" +2 newList = [] +2 +1 +1 for key in d: +2 +1 +1 if d[key] not in newList: +2 newList.append(d[key]) +2 return newList def +1 uniqueValues +1 (d) +1 : +1 """doc""" +2 newList = [] +2 for +2 key in d +1 : +1 if +2 d[key not in newList +1 : +1 append(d[key]) +2 return newList +2 QUESTION 4 (16 pts) =================== 1. i = 0 (not list[0]) 2. while i < len(list) not <= len(list) 3. list[i] > 0 not list[i] >= 0 4. return count == 0 5. missing i += 1 at end of while loop 6. count -= 1 not count == 1 QUESTION 5 (16 pts) =================== a) Three lines of output are printed b) [2,-1,3] --> [2, 1, 3] [2,1,3] --> [2, 3, 3] [2,3,-1] --> [2, 5, -1] c) [2,-1,3] --> [2,1,4,3] [2,1,3] --> [2,3,6,3] [2,3,-1] --> [2,5,4,3] [