Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions maths/last_digit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def last_digit(n: int) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide descriptive name for the parameter: n

"""
Return the last digit of a given integer.

>>> last_digit(1234)
4
>>> last_digit(-98)
8
>>> last_digit(0)
0
"""
return abs(n) % 10