We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1a9486 commit 73e9917Copy full SHA for 73e9917
1 file changed
maths/last_digit.py
@@ -0,0 +1,12 @@
1
+def last_digit(n: int) -> int:
2
+ """
3
+ Return the last digit of a given integer.
4
+
5
+ >>> last_digit(1234)
6
+ 4
7
+ >>> last_digit(-98)
8
+ 8
9
+ >>> last_digit(0)
10
+ 0
11
12
+ return abs(n) % 10
0 commit comments