Last active
August 11, 2016 07:31
-
-
Save Miha-Pleskovic/5c40119822cc212c6556dbb4c4c12a40 to your computer and use it in GitHub Desktop.
Forensics Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
hair_color = {"black": "CCAGCAATCGC", | |
"brown": "GCCAGTGCCG", | |
"blonde": "TTAGCTATCGC"} | |
face_shape = {"square": "GCCACGG", | |
"round": "ACCACAA", | |
"oval": "AGGCCTCA"} | |
eye_color = {"blue": "TTGTGGTGGC", | |
"green": "GGGAGGTGGC", | |
"brown": "AAGTAGTGAC"} | |
gender = {"female": "TGAAGGACCTTC", | |
"male": "TGCAGGAACTTC"} | |
race = {"white": "AAAACCTCA", | |
"black": "CGACTACAG", | |
"asian": "CGCGGGCCG"} | |
class Suspect(object): | |
def __init__(self, name, gender, race, hair_color, eye_color, face_shape): | |
self.name = name | |
self.gender = gender | |
self.race = race | |
self.hair_color = hair_color | |
self.eye_color = eye_color | |
self.face_shape = face_shape | |
suspects_list = [] | |
eva = Suspect(name="Eva", gender="female", race="white", hair_color="blonde", eye_color="blue", face_shape="oval") | |
larisa = Suspect(name="Larisa", gender="female", race="white", hair_color="brown", eye_color="brown", face_shape="oval") | |
matej = Suspect(name="Matej", gender="male", race="white", hair_color="black", eye_color="blue", face_shape="oval") | |
miha = Suspect(name="Miha", gender="male", race="white", hair_color="brown", eye_color="green", face_shape="square") | |
suspects_list.append(eva) | |
suspects_list.append(larisa) | |
suspects_list.append(matej) | |
suspects_list.append(miha) | |
# PROGRAM STARTS HERE | |
print "" | |
print " FORENSICS PROGRAM" | |
print "=========================================================" | |
print " you got DNA, we got your man" | |
print "" | |
print "Include a file named 'dna.txt' into the directory. Press ENTER to continue." | |
q = raw_input("") | |
try: | |
testing = open("dna.txt", "r") | |
testing.close() | |
except: | |
print "FILE NOT FOUND!" | |
quit() | |
print "FILE FOUND" | |
print "" | |
print "SEARCHING FOR DNA MATCHES ..." | |
print "" | |
culprit = [] | |
f = open("dna.txt").read() | |
for item in gender: | |
if gender[item] in f: | |
print "Gender: " + item | |
culprit.append(item) | |
for item in race: | |
if race[item] in f: | |
print "Race: " + item | |
culprit.append(item) | |
for item in hair_color: | |
if hair_color[item] in f: | |
print "Hair color: " + item | |
culprit.append(item) | |
for item in eye_color: | |
if eye_color[item] in f: | |
print "Eye color: " + item | |
culprit.append(item) | |
for item in face_shape: | |
if face_shape[item] in f: | |
print "Face shape: " + item | |
culprit.append(item) | |
print "" | |
for suspect in suspects_list: | |
if suspect.gender == culprit[0] and suspect.race == culprit[1] and suspect.hair_color == culprit[2] and suspect.eye_color == culprit[3] and suspect.face_shape == culprit[4]: | |
print "DNA MATCH FOUND!" | |
print suspect.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
še .close() ti manjka.