0

So I'm trying to set up if statements to convert codons (I'm lazy) and I want to put more than one value. I tried to put "or" between two values like so:

user = input("What is the codon you would like to translate? ").upper()

if user == "UUC" or "UUG" or "UCU":
    print("Phe")

But even if it worked, if I added another user = input situation, for example:

user = input("What is the codon you would like to translate? ").upper()
if user == "UUC" or "UUC":
    print ("Phe")

if user == "UUA" or "UUG" or "CUU" or "CUC" or "CUA" or "CUG":
    print ("Leu")

It would print out both "Phe" and "Leu" when I only want it to print "Phe". The IDLE shell would look like this:

>>>
What is the codon you would like to translate?: uuc
Phe
Leu
>>>

How would I only get it to print out "Phe" if I enter something like "UUC" instead of getting it to print both "Phe" and "Leu?"

0 Answers0