Dremendo Tag Line

Input number and print its last digit in Python

input() - Question 4

In this question, we will see how to input a number in Python programming using the input() function and print its last digit. To know more about input() function click on the input() function lesson.

Q4) Write a program in Python to input a number and print its last digit.

Number = 245
Last digit = 5

Program

print('Enter a number')
n=int(input())
ld=n%10
print('Last digit={}'.format(ld))

Output

Enter a number
483
Last digit=3
video-poster