DigitAt🔗

Type: Transpilable verification function
Get the digit at index of head followed by tail.
We can not concatenate the strings, so we index into them as if they were one.
head🔗
First part of the digits
tail🔗
Second part of the digits
index🔗
Zero-based index of the digit
Return🔗
The digit at index, or zero beyond the digits

Code

if index < len(head):
    return int(head[index : index + 1])

tail_index = index - len(head)
if tail_index < len(tail):
    return int(tail[tail_index : tail_index + 1])

return 0