Python Forum
Program to check whether a number is palindrome or not
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to check whether a number is palindrome or not
#1
Bug 
A palindrome number is a number which if written backwards also, the number will look the same
Eg: 112211, 121, 898

I have a homework to write a program to check if a number is palindrome or not using concepts of loops
I failed miserably.

My code:
Input = input("Enter any number: ")
LengthOfInput = int(len(Input))
for x in range(LengthOfInput):
    a = 10


while Input:
    if Input[0] == Input[LengthOfInput]:
        continue
        if Input[x] == Input[LengthOfInput-x]:
            x=10
    else:
        print("Number is not palindrome")

print("The number is a palindrome")
  
Error:
LengthOfInput = len(Input) TypeError: object of type 'int' has no len()
Please help with this project, it is a very interesting project that I was not able to figure out by myself

Thank you!
Reply


Messages In This Thread
Program to check whether a number is palindrome or not - by PythonBoy - Sep-07-2023, 01:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Program to Find the Factorial of a Number elisahill 2 1,533 Nov-21-2022, 02:25 PM
Last Post: DeaD_EyE
  Program that allows to accept only 10 integers but loops if an odd number was entered gachicardo 4 3,794 Feb-24-2022, 10:40 AM
Last Post: perfringo
  Palindrome checker case sensive edwdas 3 2,750 Nov-07-2019, 05:57 PM
Last Post: nilamo
  Program that displays the number with the greatest amount of factors ilusmd 3 2,909 Nov-01-2018, 08:28 PM
Last Post: ichabod801
  Palindrome program - I can't figure it out. Gabar112 3 3,646 Feb-20-2018, 07:03 PM
Last Post: Larz60+
  Palindrome.strip pirts.emordnilaP RodNintendeaux 4 3,995 Oct-08-2017, 02:30 AM
Last Post: RodNintendeaux
  Program to print: Last Name, ID, Mobile Number, All panick1992 14 10,027 Mar-15-2017, 02:46 PM
Last Post: panick1992

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020