Limiting user input to a range in Python

Another implementation:

shift = 0
while not int(shift) in range(1,27):
    shift = input("Please enter your shift (1 - 26) : ")#choose a shift

Leave a Comment