0

I've mostly completed my code for PSet 6, except for the last part where I need to match up the values against the list of names.

I know how to get the maximum occurances of the STRs and state the most prominent one, which I just need to match up against the actual people in the CSV.

It's likely a syntax misunderstanding I have with Python, but I'd appreciate some advice on how to match against the original CSV list:

for i in range (STR_number):
    if readtext.count(STRs[i]) > maxSTRcount:
        maxSTRs = readtext.count(STRs[i])
        maxSTRcate = STRs[i]
print(f"maxSTRcate: {maxSTRcate}")
print(f"maxSTRs: {maxSTRs}")



with open(database_name, newline='') as csvfile:
    dictionary = csv.DictReader(csvfile)
    for row in dictionary:
        if maxSTRs in row[maxSTRcate]:
            print(row['name'])

It's the second half I'm having trouble understanding why we can't sort it like this.

You must log in to answer this question.

Browse other questions tagged .