I am trying to learn python and did some research here but was unable to put the bits of info together... My instructor has handed me an additional task for which after searching online parts of code I found it difficult to finish...actually I am learning python for the last two weeks.
I have a file named
dna.txt
which has below data stored
ACAAGATGCCATTGTCCCCCGGCCTCCTGCTGCTGCTGCTCTCCGGGGCCACGGCCACCGCTGCCCTGCCCCTGGAGGGTGGCCCCACCGGCCGAGACAGCGAGCATATGCAGGAAGCGGCAGGAATAAGGAAAAGCAGCCTCCTGACTTTCCTCGCTTGGTGGTTTGAGTGGACCTCCCAGGCCAGTGCCGGGCCCCTCATAGGAGAGGAAGCTCGGGAGGTGGCCAGGCGGCAGGAAGGCGCACCCCCCCAGCAATCCGCGCGCCGGGACAGAATGCCCTGCAGGAACTTCTTCTGGAAGACCTTCTCCTCCTGCAAATAAAACCTCACCCATGAATGCTCACGCAAGTTTAATTACAGACCTGAA
I have then details of three males as in eye color, hair color, etc...and I am supposed to have a program running that would check the data stored in the txt file read it and them compare it with the info on the males and print out who is the match...
what I have been able to put together is:
evidence = open("dna.txt", "r").read()
john= {
"gender": "TGCAGGAACTTC",
"race": "AAAACCTCA",
"color_hair": "TTAGCTATCGC",
"color_eyes": "AAGTAGTGAC",
"type_face": "ACCACAA"
}
matthew = {
"gender": "TGCAGGAACTTC",
"race": "AAAACCTCA",
"color_hair": "CCAGCAATCGC",
"color_eyes": "TTGTGGTGGC",
"type_face": "AGGCCTCA"
}
edward = {
"gender": "TGCAGGAACTTC",
"race": "AAAACCTCA",
"color_hair": "GCCAGTGCCG",
"color_eyes": "GGGAGGTGGC",
"type_face": "GCCACGG"
}
and now I am stuck what next,
on my previous "easier" assignment without using dicts I continued with if, and, elif
, etc...but not sure if in this case would use the same..
I did some tries with
if evidence.find('John') > -1 :
print "john is the thief!"
elif evidence.find('Matthew') > -1 :
print "matthew is the thief!"
elif evidence.find('Edward') > -1 :
print "edward is the thief!"
but not sure if this the right move, although the code is running but does not actually print the name of the guy. again I have no previous experience with python...I might completely miss the solution, especially since I got instructions to use "arrays & "dictionaries" - if I got it right
thanks folks for helping me out..