Question

(Palindrome integer) Write the functions with the following headers: # Return the reversal of an integer,...

(Palindrome integer) Write the functions with the following headers:

# Return the reversal of an integer, e.g. reverse(456) returns # 654 def reverse(number):

# Return true if number is a palindrome def isPalindrome(number):

Use the reverse function to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

main.py 1 def reverse(): sn=strnnmtere) return sn 2 4 5 def isPalindrome (number): if reverse()=reverse()[::-1]: return theg

output

Enter the number to check whether it is a palindrome : 1234567 or not the qiven number is not a palindrome . ..Program finish

Code for copying (check for indentation while copying);

def reverse():
sn=str(number)
return sn
  
def isPalindrome(number):
  
if reverse()==reverse()[::-1]:
return "the given number is palindrome"
else:
return "the given number is not a palindrome"
  
  
  
number=int(input("Enter the number to check whether it is a palindrome or not : "))
print(isPalindrome(number))

Add a comment
Know the answer?
Add Answer to:
(Palindrome integer) Write the functions with the following headers: # Return the reversal of an integer,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT