int_input

int_input Convenience Function
code def int_input( prompt ): x = raw_input(prompt) flag = False while flag == False: try: x = int(x) return x       except: try: x = float(x) print "An integer doesn't have a decimal. Please try again." x = raw_input( prompt ) except: print "An integer is a number with no decimals. Please try again." x = raw_input( prompt ) code