Python

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""
Asha Rajagopal
DNA lab
2/11/2019
"""
dna_total = []

dna_strand = input("What is the DNA stand you would like to use?")
for i in dna_strand:
  dna_total += i

def analyze(dna_total):
  """ the RNA used to transcribe DNA into its complementary strand"""
  copy = []
  for nucleaic_acid in dna_total:
    if nucleaic_acid == "C":
      copy += "G"
    elif nucleaic_acid == "G":
      copy += "C"
    elif nucleaic_acid == "T":
      copy += "A"
    else:
      copy += "T"
  return copy

def transcribe(dna_total,complementary):
  """uses the existing DNA starnds and produces RNA synthesis"""
  first_rna = []
  for nucleaic_acid in dna_total:
    if nucleaic_acid == "C":
      first_rna += "G"
    elif nucleaic_acid == "G":
      first_rna += "C"
    elif nucleaic_acid == "T":
      first_rna += "U"
    else:
      first_rna += "T"
  second_rna = []
  for nucleaic_acid in complementary:
    if nucleaic_acid == "C":
      second_rna += "G"
    elif nucleaic_acid == "G":
      second_rna += "C"
    elif nucleaic_acid == "T":
      second_rna += "A"
    else:
      second_rna += "U"
  return first_rna,second_rna
print()


def codon_formation(first_rna,second_rna):
  print("\nfirst strand")
  print_= []
  while len(first_rna) > 0:
    for i in range(1,4):
      if not first_rna:
        print("\nSecond strand")
      else:
        print_.append(first_rna.pop(0))
    for i in print_:
      print(i, end = '')
    print()
    for i in range(0,3):
      print_.pop(0)
  print('\nSecond strand')  
  while len(second_rna) > 0:
    for i in range(1,4):
      if not second_rna:
        print()
      else:
        print_.append(second_rna.pop(0))
    for i in print_:
      print(i, end = '')
    print()
    for i in range(0,3):
      print_.pop(0)
  print()

    
        






def main():
  for i in dna_total:
    print(i, end ='')
  first_rna = analyze(dna_total)
  print("-->", end = "")
  for i in first_rna:
    print(i,end = "")
  first_strand,second_strand = transcribe(dna_total,first_rna)
  print("\nthe new RNA strands are:")
  for i in first_strand:
    print(i,end = "")
  print()
  for i in second_strand:
    print(i,end = '')
  codon_formation(first_strand,second_strand)
  input("\nPress enter to exit")


main()