how do i set limits in inputs in python

Solutions on MaxInterview for how do i set limits in inputs in python by the best coders in the world

showing results for - "how do i set limits in inputs in python"
Roberto
06 May 2017
1shift = 0
2while 1 > shift or 26 < shift:
3    try:
4        # Swap raw_input for input in Python 3.x
5        shift = int(raw_input("Please enter your shift (1 - 26) : "))
6    except ValueError:
7        # Remember, print is a function in 3.x
8        print "That wasn't an integer :("