I have nearly completed DNA in Pset6 of CS50 but I am having difficulty on the last section. I have managed to populate each of the max_AGATC, max_TTTTTTCT, max_AATG etc. with the correct values from the given sequence and I have checked that these are correct. For example, if I input sequence 10 into the full code, I get the following values:
- max_AGATC =15
- max_TTTTTTCT = 49
- max_AATG = 38
- max_TCTAG = 5
- max_GATA = 14
- max_TATC = 44
- max_GAAA = 14
- max_TCTG = 12
These correspond exactly to Albus' DNA
It also appears that each row[]
is populating correctly. However, when I try and compare the two figures, they are are not being identified as such and the outcome of this is that every sequence identifies as a no match. Any ideas what I am doing wrong? (nb people_count always ends up being 23 and I have imported csv)
database_original = open(argv[1], "r")
database_read = csv.DictReader(database_original)
n = 0
for row in database_read:
if row['AGATC'] == max_AGATC and row['TTTTTTCT'] == max_TTTTTTCT and row['AATG'] == max_AATG and row['TCTAG'] == max_TCTAG and row['GATA'] == max_GATA and row['TATC'] == max_TATC and row['GAAA'] == max_GAAA and row['TCTG'] == max_TCTG:
print(row['name'])
break
n += 1
if n == people_count:
print('No match')
break