Hey guys, I need to print a dictionary from a text file and than print it again with the last two values updated in each row.
The text file appears as so:
12345678 Joe Dokes IT 30 95
87654321 Sally Sue ISYS 50 87
34876293 Bo Burnham MATH 60 78
98375498 Yarg Noreamac PWN 45 97
I was able to print the initial dictionary, and at least start to set up the second dictionary, but I am a little confused as to how to ask the user to update the credits (30, 50, 60, 45) and the number of quality points (95, 87, 78, 97) four times.
myDict = {}
myDict2 = {}
def main():
myFile = open('prog3.txt','r')
for line in myFile:
techID, first, last, major, credit, quality = line.split()
stuRec = [first, last, major, credit, quality]
myDict[techID] = stuRec
print myDict
main()
def submain():
myFile = open('prog3.txt', 'r')
credit2 = raw_input("Please enter the updated credits.")
update2 = raw_input("Please enter the updated quality points.")
for line in myFile:
techID, first, last, major, credit, quality = line.split()
stuRec = [first, last, major, credit, quality]
myDict2[techID] = stuRec
print myDict2
submain()