Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
def encrypt_message(text, x): text = list(text) for y in text: ord(text)
ord() は長さ 1 のストリングを予期していましたが、リストが見つかりました。
問題は、 を渡す必要がある関数に をtext渡したということです。ordy
text
ord
y
ただし、文字列は反復可能なオブジェクトであるため、文字列をループするだけです。
def encrypt_message(text, x): return [ord(i) for i in text]