I'm attempting to write this program that reads in a sequence into a string variable, called sequence
, and finds out if sequence
contains a valid DNA sequence or not. I want to use a single for
and one if-elif-else
statement to determine whether the sequence is valid DNA or not.
This is what I have written so far:
sequence = input().upper()
dont_include = "BDEFHIJKLMNOPQRSUVWXYZ"
include = "ACGT"
sequence= input("Please enter a sequence: ")
dont_include = dont_include.split(' ')
#sequence = sequence.split(' ')
common=0
for eachletter in sequence:
if eachletter in dont_include:
common +=1
print(common)
elif eachletter in dont_include:
print("This is not a valid DNA sequence")
else:
print()
My program doesn't do exactly what I want... How can I improve it?
Aucun commentaire:
Enregistrer un commentaire