Apr-15-2017, 10:40 PM
Write a program that displays the current justices ordered by the year they joined the Supreme Court.
So there is a file containing the justices in this form:
Henry,Baldwin,Andrew Jackson,PA,1830,1844
I have to create a new file and sort them into justices ordered by year they joined, and remove the excess information. Ex: Henry Baldwin.
This is what I have so far but I'm just starting out so I'm having difficulty. Any pseudocode or suggestions would be helpful. Thanks
So there is a file containing the justices in this form:
Henry,Baldwin,Andrew Jackson,PA,1830,1844
I have to create a new file and sort them into justices ordered by year they joined, and remove the excess information. Ex: Henry Baldwin.
This is what I have so far but I'm just starting out so I'm having difficulty. Any pseudocode or suggestions would be helpful. Thanks
def main(): justices = placeDataIntoList("Justices.text") justices.sort createFile(justices) def placeDataIntoList(fileName): data = [] infile = open(filename, 'r') line = infile.readLine() for i in range(0,n): data = line.splt(',') justices(i).firsName = data(0) justicess(i).lastName = data(1) justices(i).apptPres = data(2) justices(i).state = data(3) justices(i).yrAppointed = data(4) justices(i).yrLeft = data(5) return data
Attached Files