3

My code always outputs "No Match", so I ran it on debug50. My counting function is right some of the time, but even when I know that it's counted STRs correctly, it output's "No Match". I ran debug50 on just the code that looks for a match, and I found out that for some reason, it skips the for loops that have all the code that saves and compares everything in them. I know that the for loop runs if it's not "for i in csv_file" but instead using the range() function. I don't know why this is as I do the exact same thing earlier in my code. Csv_file is the .reader() of small.csv or large.csv, depending on what you put as the command-line-argument.

# comparing repetitions with people
csv_dic = []
count = 0
match = False
for i in csv_file:
    csv_dic.append(csv_file[i])
for line in csv_file:
    name = line[0]
    for i in range(len(maxes)):
        if csv_dic[i] == maxes[i]:
            match = True
            match_name = name
if match == True:
    print(match_name)
else:
    print("No Match")
file.close()
f.close()
mkg15
  • 43
  • 7

1 Answers1

3

I know what's your problem. When you're doing this loop:

for i in range(len(maxes)):
        if csv_dic[i] == maxes[i]:
            match = True
            match_name = name

You're not considering that csv_dict does not contain a value, but rather a name or the name of the STR itself. You should change it to this:

for i in range(1, len(maxes)):
        if csv_dic[i] == maxes[i]:
            match = True
            match_name = name

Hopes this solves your problem! :)

Nicolas F
  • 505
  • 6
  • 17