“Charcodeat Python” Kod odpowiedzi

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)}."
Thankful Toucan

Python pokazuj kod Charracter

>>> ord('a')
97
>>> chr(97)
'a'
>>> chr(ord('a') + 3)
'd'
>>>
slaff

Odpowiedzi podobne do “Charcodeat Python”

Pytania podobne do “Charcodeat Python”

Więcej pokrewnych odpowiedzi na “Charcodeat Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu