i want to limit the users input in two cases:
1.With a string and split, when asking the user to put in two, 2 digit numbers I wrote:
x=raw_input("words").split()
I want to only enable him to write an input that is two 2 digit numbers, and if he does something else I want to pop an error, and for him to be prompted again, until done right.
2.This time an INT when asking the user for a random 4 digit number:
y=int(raw_input("words"))
I only want to allow (for example) 4 digit numbers, and again if he inputs 53934 for example I want to be able to write an error explaining he must only enter a 4 digit number, and loop it back until he gets it right.
Thank you, hopefully I explained myself properly.
update
so - trying to start simple i decided that at first ill only try to ask the user to type in 8 letters. for example an qwertyui input is acceptable, but sadiuso (7 chars) is not.
so i tried working with the syntax you gave me and wrote:
y=raw_input("words") if not (len(y) == 8):
pop an error
but im getting a syntax error on the :