Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 4 - Selections - Programming Exercises - Page 126: 4.26

Answer

code

Work Step by Step

# 4.26 (Palindrome number) Write a program that prompts the user to enter a three-digit # integer and determines whether it is a palindrome number. # A number is a palindromeif it reads the same from right to left and from left to right. num = int(input("Enter a three-digit integer: ")) N = num n1 = num // 100 num %= 100 n2 = num // 10 num %= 10 n3 = num if n1 == n3: print(str(N),"is a palindrome") else: print(str(N), "is not a palindrome")
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.