-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpunnet_square.py
More file actions
61 lines (47 loc) · 1.67 KB
/
punnet_square.py
File metadata and controls
61 lines (47 loc) · 1.67 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python
# -*- coding: ascii -*-
"""
Powered by tylermsa
Made back in late-2020/ early-2021 back when I used Python 2
Updated in 2025 Thanks to Python3
"""# TODO: Look up how to add ASCII Characters on Linux os files
from random import *
# raw = raw.encode('ascii', 'ignore')
def draw_square(par1_dom, par1_res, par2_dom, par2_res):
#Print seperate space
print(" ")
#Print Parent 1 Genes
print(" {} | {}".format(par1_dom, par1_res))
# raw = raw.encode('ascii', 'ignore')
#Print Borders
print(" ===========")
# raw = raw.encode('ascii', 'ignore')
#Print Parent 2 gene1, border, and top punnet
print(" {} | {}{} | {}{} |".format(par2_dom, par1_dom, par2_dom, par2_dom, par1_res))
# raw = raw.encode('ascii', 'ignore')
print(" - |----|----|")
# raw = raw.encode('ascii', 'ignore')
#Print Parent 2 gene1, border, and bottom punnet
print(" {} | {}{} | {}{} |".format(par2_res, par1_dom, par2_res, par2_res, par1_res))
# raw = raw.encode('ascii', 'ignore')
print(" ===========")
print(" ")
#
# E | x
# ===========
# E | EE | Ex |
# - |----|----|
# x | Ex | xx |
# ===========
parent1 = " "
parent2 = " "
print("Python Punnett Square")
print("powered by tylermsa")
print("- - - - - - - - - - - - - - - - - - - - - - - -")
print(" ")
#print("Enter the gene pair of Parent 1:")
parent1 = input("Enter the gene pair of Parent 1: ") # replacing raw_input() since that has been deprecated in python3
#print("Enter the gene pair of Parent 2:")
parent2 = input("Enter the gene pair of Parent 2: ") # replacing raw_input() since that has been deprecated in python3
draw_square(parent1[:1], parent1[1:], parent2[:1], parent2[1:])
# End of Code