@JackSloan/

Punnet Ting

Python 2.7

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
dominant = 0

print """


Input your traits from each parent and find the chance of the dominant trait showing up in offspring.

"""
a1a = raw_input("Enter first allele in organism 1? Using T or t: ")

a1b = raw_input("Enter second allele in organsim 1 using T or t: ")

a2a = raw_input("Enter first allele in organsim 2 using T or t: ")

a2b = raw_input("Enter second allele in organism 2 using T and t: ")

if a1a=="T" and a1b=="T" or a2a=="T" and a2b=="T":
  print "100% of offsrping will show the dominant trait"

#tr refers to top right square of a punnet sqaure, tl is top left, bl is bottom left, and br is bottom right 

tl=a1a + a2a
bl=a1a + a2b

tr=a1b + a2a
br=a1b + a2b


if tl=="Tt" or tl=="TT" or tl=="tT":
  dominant = dominant+1
  

if tr=="Tt" or tr=="TT" or tr=="tT":
  dominant = dominant+1

if bl=="Tt" or bl=="TT" or bl=="tT":
  dominant = dominant+1

if br=="Tt" or br=="TT" or br=="tT":
  dominant = dominant+1

print "The chance of the dominant trait showing up in offsrping is:"
visdominant = dominant/4.0
print str(visdominant * 100) + "%"