Either the answer to that question will work, or I've read that you don't need to actually name them... so i tried this:
class Entry():
__slots__ = ('name', 'gender', 'occurances')
def mkEntry(name_foo, gender_foo, occurances_foo):
myEntry = Entry
myEntry.name = name_foo
myEntry.gender = gender_foo
myEntry.occurances = occurances_foo
return myEntry
def topTwenty(fileName):
file = open(fileName)
topTwenty = []
femaleCount = 0
maleCount = 0
for line in file:
a = line.split(",")
if a[1] == 'F' and femaleCount < 20:
topTwenty.append(mkEntry(a[0], a[1], a[2]))
femaleCount = femaleCount + 1
print(topTwenty[7].name)
but the print(topTwenty[7].name) is printing what i expect from topTwenty[20].name
any help?