0

Please I need help. I dont know how to convert a String in an Int to complete the ASCII Formula in Python. (a = string[i] - 65)

HERE IS A FRAGMENT OF MY CODE:

for i in range(len(string)):
    if (string[i].isalpha()):
        #ASCII VALUES
        if (string[i].isupper()):
            a = string[i] - 65
            b = (a + key) % 26
            c = b + 65
            print(c)

ERROR:
Traceback (most recent call last):
  File "caesar.py", line 14, in <module>
    a = string[i] - 65
TypeError: unsupported operand type(s) for -: 'str' and 'int'
0

Have another look into the hints:

You might find chr and/or ord of help.

| improve this answer | |

You must log in to answer this question.