Skip to content

Instantly share code, notes, and snippets.

@jQwotos
Created December 19, 2016 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jQwotos/26263d07f93a800d4d03657fb3109627 to your computer and use it in GitHub Desktop.
Save jQwotos/26263d07f93a800d4d03657fb3109627 to your computer and use it in GitHub Desktop.
Takes in a string of codons and converts them into anticodons
i = 'AUG|UUU|GUA|CAU|UUG|UGU|GGG|AGU|CAC|CUG|GUU|GAG|GCG|UUG|UAU|UUG|GUU|UGU|GGC|GAG|CCC|GGC|UUU|UAC|CAG|UUA|GAG|AAU|UAC|UGA'
x = ''
convert = {
'A' : 'U',
'G' : 'C'
}
for letter in i:
y += i
if letter == "|":
x += "|"
else:
for key, value in convert.items():
if letter == key:
x += value
elif letter == value:
x += key
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment