a = ord("plaintext[i]")? even though I do this: a = ord(plaintext[i], the response is the same!

The compiler returns with this reply: Please, help!!!

Traceback (most recent call last): File "caesar.py", line 26, in a = ord("plaintext[i]") TypeError: ord() expected a character, but string of length 12 found

1 Answer 1


Resolved. No need for the "" or ''.

  • For reference, this is not a Python-only syntax issue. When you use " " in both C and and Python, it means a literal string. So "plaintext[i]" is really just a bunch of letters (12, to be precise, as Python said), not the i-th element in plaintext array.
    – MestreLion
    Nov 25, 2020 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .