Here's one way, assuming you are talking about integers and the decimal system:
def extract_digit(n, number):
number = abs(number)
for x in range(n-1):
number = number // 10 #integer division, removes the last digit
return number % 10
0
CodeRocks
On
Convert to a string, reverse the string, and then take the index of the string and convert the string back into an integer. This works:
You could convert the number to a string and then use a negative index to access a specific digit from the end: