I need to read in a list from a text file, put that list in a list, read in the amount of credits the students earned as an int, and than add 16 credits to the list.
Here is my code so far:
myList2 = []
myList = []
myFile = open('lab11.txt','r')
for myLine in myFile:
myList = myLine.split()
myList[3] = int(myList[3])
myList2.append(myList)
print myList2
Currently, I can print a list inside a list. I am not sure how to take a specific value from a list and convert it to an int. The text file appears as follows:
Max Medium MATH 58
Jane Johnson GEOG 78
Bill Bupkiss BIOL 29
Harold Humphries HLTH 43
Carol Cramer CIS 102
Alvin Adams ART 67
Fred Frederick FINA 81
Phillip Parker PHIL 44
Sam Spade SOC 16