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:
Thank you!
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 myselfThank you!