I am new to python and I am trying to figure out how to check user input. I want to ask the user to submit the DNA sequence and confirm that it is a DNA sequence. Acceptable inputs can have upper or lower case ATCG and spaces, and I donβt know exactly how to do this.
So far I can request input, but not test it.
import sys
Var1 = raw_input("Enter Sequence 1:")
Then I want to do something like:
if Var1 != ATCG (somehow put 'characters that match ATCG or space)
print "Please input valid DNA sequence"
sys.exit() (to have it close the program)
Any help? I feel this should be pretty simple, but I don't know how to indicate that it can be any ATCG, atcg or space.
source
share