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

how do i round to the nearest whole number:examples:  25.6, 327.9, 58.2, othersand fractions like this: 109 3/4 if i can round to the nearst  whole number teel
Explain how you know that 7/12 is greater than 1/3 but less than 2/3?
How to find greatest common factor  45 and 81
Ms groves had trays of paint each tray has five colors one of the colors is purple.what fraction of the colors in 20 trays is purple
The main goal of the Jesuits was to?
What values can n have to make each equation true |n|=3 and |n|=14 |n|=1
95 is 95% of what number?
What is 17% as a fraction in simplest form
Explain how you know that 7/12 is greater than 1/3 but less than 2/3?
Use the form y=mx +b for linear equations.Write the equation for the following relation.C = {(x, y): (6, 15), (8, 21), (10, 27), . . .}