Compsci 6, Fall 2011, Classwork 15

PRINT Names and NetID of students in group (min 2, max 3)
Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

Name: __________________________   NetID: _____________

For these problems, see the file popular.py

Problem 1:

def uniqueFirstNames(data): ''' The parameter data is a list of lists where each list is two strings representing the first and last name of a person. Return a list of the unique first names of all the people. ''' uniqueNames = set([]) #TODO:

Problem 2:

def uniqueLastNames(data, firstName): ''' The parameter data is a list of lists where each list is two strings representing the first and last name of a person. The string parameter firstname is the first name of a person (one word). Return a list of the last names of all the people from data with this first name. Assume each person in data is unique. ''' return [] #TODO; Replace me

Problem 3:

def correspondingLastNames(data, firstNames): ''' The parameter data is a list of lists where each list is two strings representing the first and last name of a person. The parameter firstNames is a list of the unique first names from data. return a list of lists of last names such that the nth list of last names corresponds to the nth first name in firstNames. ''' lastNames = [] #TODO: return lastNames

Problem 4:

def printFirstWithLasts(firstNames, lastNames): print "Print Unique First Names with all Last Names" #TODO:

Problem 5:

print "first name with most last names is:" #TODO: print

Problem 6:

def processFiles(numberFiles): ''' Given the number of files to process, assume all have the name "namesNUM.txt". Process all those files ''' nameList = [] for number in range(1,numberFiles+1): filename = "" #TODO: return nameList