Final Digit

The last digit of a number is useful in many checks, such as detecting even numbers or processing an ID piece by piece. Write a function last_digit that takes a non-negative integer n. Return its last digit.

Примеры

Ввод
12345
Вывод
5
Ввод
0
Вывод
0
Ввод
10
Вывод
0

Нужно реализовать

def last_digit(n: int) -> int:

Теги

math
PostgreSQLv16

Ovdje će se prikazati rezultat izvršavanja koda

Visible tests
1
Input
12345
Expected5
2
Input
0
Expected0
3
Input
10
Expected0
4
Input
7
Expected7
5
Input
999
Expected9
6
Input
3
Expected3
Focus radio
Paused · SomaFM · Fluid