Compsci 6, Fall 2011, Classwork 12
PRINT Names and NetID of students in group (min 2, max 3)
Name: __________________________ NetID: _____________ Name: __________________________ NetID: _____________
Name: __________________________ NetID: _____________
Problem 1:
This problem is related to the ProcessCrimeRates2.py code.
def convertToNums(data):
'''
data is the complete column, and row is the first row with
a valid data item. The data items are strings such as '4.3'
but some of them are empty '' and must be ignored.
return a list of floats of all the strings that are
valid numbers
'''
# TODO: return list comprehension
return
Problem 2:
This problem is related to the ProcessCrimeRates2.py code.
def getStatesWithRate(alldata, startpos, num):
'''
alldata is all of the data in a list of lists of strings
startpos is the (row,column) position of the category,
row+1 would be where the numbers start.
return a list of states (from column 0) that have num in them
in column 'column'
num is a float
'''
states = []
# TODO: finish body of loop
for row in range(startpos[0]+1,len(alldata)):
return states
Problem 3:
Which of the following are equivalent to s^t
for sets
s
and t
(more than one is possible)?
-
(s-t) | (t-s)
-
(s|t) - (s&t)
-
(s|t|(s&t))