Answers for "charcodeat python"

1

charcodeat python

def charcodeat(string,index):
  if isinstance(string,str) and isinstance(index,int):
    return ord(string[index])
  else:
    raise Exception(f"Error: charcodeat takes a str and an int, received {type(string)} and {type(int)}."
Posted by: Guest on May-08-2022
0

python show charracter code

>>> ord('a')
97
>>> chr(97)
'a'
>>> chr(ord('a') + 3)
'd'
>>>
Posted by: Guest on April-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language