0
Please help me in finding the mistake.
# Reverse a number in python Number = int(input(" ") ) print("\n Entered Number = %d" %Number) Reverse = Null while(Number > Reverse ): Reminder = Number %10 Reverse = (Reverse *10) + Reminder Number = Number //10 if(%Number == %Reverse) print("Palindrome number") else print("\n Reverse of entered number = %d" %Reverse)
1 Respuesta
+ 2
- you need colon after if condition
- you don't need paranthesis in if condition and while loop
- you don't need that percent sign in the last if confdition
- equivalent null in python is "None" (this is case-sensitive)
these are only the syntax mistakes but i didn't undestand what you want to do exactly...
edit: it seems to work if you initialize "Reverse" as 0. Reverse can't be None because in that case while loop doesn't know how to solve his condition...