Can someone explain the program and help me to find out semantic error if possible. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain the program and help me to find out semantic error if possible.

https://code.sololearn.com/cG6MU9fqWAnJ/?ref=app

13th Oct 2019, 6:22 PM
Navin Rai
Navin Rai - avatar
3 Answers
+ 1
nu=int(input("enter num")) originalnum= nu def rever(nu): rev=0 while (nu>0): rem=nu%10 rev=(rev*10)+rem nu//=10 print("\nrev is",rev) if originalnum ==rev: print(originalnum ,"is palindrome") else: print(originalnum ,"is not a palindrome") rever(nu)
13th Oct 2019, 7:32 PM
Ruba Kh
Ruba Kh - avatar
+ 1
This code return the reverse of a number and see if its a Palindrome or not, the only mistake is that you did not save the number inputed in another variable because in the end nu will always be zero
13th Oct 2019, 7:35 PM
Ruba Kh
Ruba Kh - avatar
0
How , can you rewrite the program.
13th Oct 2019, 6:51 PM
Navin Rai
Navin Rai - avatar