using input is usually a bad idea. you might want to try something like this: while 1: age = raw_input('Age: ') try: userInfo['age'] = int(age) except ValueError: # whatever error handling you want to do, here. pass else: break alex.