vendredi 2 décembre 2016

Python - Why does the if statement get by passed?

Hi I am trying to figure out why the second string of "peptide_seq" bypasses the first if statement? The three strings are supposed to go through the if statements and return the following statements:

Convert the string to uppercase. String that contains any character that is not A C G T or U should return: "not an unambiguos nucleotide". - string that contains ACGU should return "DNA" and String that contains ACGT should return RNA

def nuc_ac_check(string):
    input_string = string.upper()

    if ('d') in input_string:
        return "not an unambigious nucleic acid"
    elif ('A' and 'C' and 'G' and 'U') in input_string:
        return "Rna"
    elif ('A' and 'C' and 'G' and 'T') in input_string:
        return "Dna"

Rna_seq = "GGUACGGCUUGGUAUCCCACUCAGUGGCACCUGUGGCCU"
peptide_seq= "acgsdtushnsdses"
Dna_seq = "ggatacgatc"

print ('the rna seq variable is: ' + nuc_ac_check(Rna_seq))
print ('the peptide seq variable is: ' + nuc_ac_check(peptide_seq))
print ('the Dna seq variable is: ' + nuc_ac_check(Dna_seq))

Aucun commentaire:

Enregistrer un commentaire