diff --git a/maths/last_digit.py b/maths/last_digit.py new file mode 100644 index 000000000000..9309a0722833 --- /dev/null +++ b/maths/last_digit.py @@ -0,0 +1,12 @@ +def last_digit(number: int) -> int: + """ + Return the last digit of a given integer. + + >>> last_digit(1234) + 4 + >>> last_digit(-98) + 8 + >>> last_digit(0) + 0 + """ + return abs(number) % 10
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: