Computer Science, asked by soniparjapati17, 1 month ago

Write a Python program to display the last digit of a number.​

Answers

Answered by sandhyarajput2003
1

Python sequence, including list object allows indexing. Any element in list can be accessed using zero based index. If index is a negative number, count of index starts from end. As we want last element in list, use -1 as index.

hope it helps

Answered by nimardoiphde
4

Answer:

This program will give you the last digit of any number.

...

def last_digit(n):

"""Returns the last digit of n."""

n = str(n)

return int(n[len(n)-1])

numbers = []

for i in range(250):

if last_digit(i) == x: #Replace 'x' with a digit.

numbers. append(i)

Similar questions