Limitar la entrada del usuario a un rango en Python
En el código a continuación, lo verá pidiendo un valor de 'cambio'. Mi problema es que quiero limitar la entrada de 1 a 26.
For char in sentence:
if char in validLetters or char in space: #checks for
newString += char #useable characters
shift = input("Please enter your shift (1 - 26) : ")#choose a shift
resulta = []
for ch in newString:
x = ord(ch) #determines placement in ASCII code
x = x+shift #applies the shift from the Cipher
resulta.append(chr(x if 97 <= x <= 122 else 96+x%122) if ch != \
' ' else ch) # This line finds the character by its ASCII code
¿Cómo hago esto fácilmente?