Dremendo Tag Line

Reverse 3 digit number in Python

input() - Question 8

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

Q8) Write a program in Python to input a three digit number and reverse it.

Input: 289
Reverse: 982

Program

print('Enter a three digit number')
n=int(input())
fd=n//100
md=(n//10)%10
ld=n%10
rev=ld*100+md*10+fd
print('Reverse={}'.format(rev))

Output

Enter a three digit number
326
Reverse=623
video-poster