在凯撒密码中,我需要它是我的大写字符保持在大写并且非字母字符保持非字母/相同。我有它可以使用小写字母。
然而,大写字母被转换为小写字母和不同的字母。非字母字符也会转换为小写字母。大写字母必须移动,但仍保持大写。非字母字符必须保持为非字母字符。
p = raw_input(("enter a word"))
n = input(("how many must it shift"))
a = 0
b = 0
c = 0
d = 0
for i in p:
if i.isupper():
a += 1
elif i.islower():
b += 1
elif i.isdigit():
c += 1
else:
d += 1
e = ""
for i in p:
if i == "":
e += i
else:
integerValue = ord(i)
integerValue-= 97
integerValue += n
integerValue %= 26
integerValue += 97
e += chr(integerValue)
print e