loop prints a error message multiple times
Question: i am having a little problem with python. At the this point the loop prints a
error message multiple times, -well equal to the number of errors in the users
input. i would prefer if the user only receive a single message

    
    
    input_seq = "";
    
    #raw_input() reads every input as a string
    input_seq = raw_input("\nPlease input the last 12 nucleotide of the target sequence 
    before the PAM site.\n\(The PAM site is by default \"NGG\"\):\n12 nt = ")
    
    #print "raw_input =", input_seq
    for bases in input_seq:
        if not (bases in "ACTGactg"):
            print "\nYour input is wrong.  Only A.T.C.G.a.t.c.g are allowed for 
            the input!\n\n";
    

Thanks for your answers, i would like to add one more constraint to the users
input, namely the input should be exactly 12 charters - no more no less what
is the correct way to add this to current if not statement ??


Answer: use `break`. I am using [regular
expressions](https://docs.python.org/2/library/re.html) to avoid using a for
loop

    
    
    input_seq = ""
    import re
    
    while True:
    
      #raw_input() reads every input as a string
      input_seq = raw_input("\nPlease input the last 12 nucleotide of the target sequence 
       before the PAM site.\n\(The PAM site is by default \"NGG\"\):\n12 nt = ")
    
      #print "raw_input =", input_seq
      if len(input_seq)==12:
        match=re.match(r'[ATCGatcg]{12}',input_seq)
        if match:
          break
        else:
          print "\nYour input is wrong.  Only A.T.C.G.a.t.c.g are allowed for the input!\n\n"
          continue
      else:
        print "\nYour input should be of 12 character"
    

