-2
저는 파이썬에서 입력 문자열 ex : HELLO 및 출력 : LIPPS를 변경해야하는 암호화 프로그램을 작성하고 있습니다. 한 단어를 더 입력 할 때 문제가 있습니다. 여기 프로그램 암호화 오류
def encr_ypt(s, n):
word=ord(s)
for i in range(len(s)):
if word >= 90 and word <= 97:
hsl = chr(63+n)
if word >= 122:
hsl = chr(95+n)
else:
hsl = chr(word+n)
return hsl
st=raw_input('input string : ')
print encr_ypt(st, 4)
는 오류 메시지
input string : HELLO
Traceback (most recent call last):
File "encrypt.py", line 13, in <module>
print encr_ypt(st, 4)
File "encrypt.py", line 2, in encr_ypt
word=ord(s)
TypeError: ord() expected a character, but string of length 5 found
무엇이 가장 좋은 방법 내가 'U'V'W'Z'을 쓰고 출력은 문자이다?/^ %, 출력이 'A'로 되돌아 가고 싶습니다. –