How to convert an ASCII char to its ASCII int value?
Just do this:
int(k)
You're just converting the char to an int directly here, no need for a function call.
A char
is already a number. It doesn't require any conversion since the ASCII is just a mapping from numbers to character representation.
You could use it directly as a number if you wish, or cast it.