Devansh03 Devansh03
  • 13-06-2022
  • Computers and Technology
contestada

Please code in python and add comments to code

Question:
Get a 4 or more digit number from the user and check if the number is Palindrome Number.

Respuesta :

Mickzminz
Mickzminz Mickzminz
  • 13-06-2022

#accepting input from user

n=int(input("Enter a number: "))

#entered number is stored in a temporary variable

temp=n

#initializng required variables

rev=0

dgt=0

#digits are reversed inside while loop

while(n>0):

dgt=n%10

rev=rev*10+dgt

n=n//10

#original number and its reverse are compared

if(temp==rev):

#if equal, it's a palindrome

print("It is a Palindrome")

else:

#if not equal, it's not a palindrome

print("It is not a Palindrome")

#◌⑅⃝●♡⋆♡Nåmřāthā♡⋆♡●⑅◌

Answer Link

Otras preguntas

A line that includes the points (d, – 2) and ( – 6, – 1) has a slope of – 1 5 . What is the value of d?
Cost-volume-profit analysis requires management to classify all costs as either fixed or variable with respect to production or sales volume within the relevant
Which of the following islands is considered part of Australia? A. Tasmania B. Seychelles C. Madagascar D. Hawaii
witch sentence is an example of an argumentative claim?
Please help i'm struggling with this!It's urgent!
A large dump truck can move 1,170 tons/h of gravel from one point to another on a work site. What is this rate in lb/s
What is the value of x and y?
(x+y,x-2y)=(4,1), find x and y
what should you do to take care of your online reputation???​
Just wanted to get other people's opinion for an essay. If a man cheats on his wife, whom he has children with, does that make him a bad father? Or just a bad h