# Python code help for beginner

Hi , i am a beginner in Python coding, can you help me to clarify if there is any issue in below coding to reverse a number. Thank you for your answers
a=int(input(‘Enter the number to be reversed=’))
rev=0
if (a==0):
print(‘the reversed value = 0’)
else:
while (a>0):
dig=a%10
rev=rev*10+dig
a=a//10
print(‘the revered number is’,rev)

What exactly do you mean by “reversing” a number?

Also you’ve probably already learned that indentation is part of the syntax in Python, so it’s impossible to read your code without it. Please use a Markdown code block to preserve it, like so:

`````````python
if hello == 'world':
print('Hello World!')
```
``````

Result:

``````if hello == 'world':
print('Hello World!')
``````

Hi, Thanks for the information
I tried to reverse a given number using python, for eg, if the given number is 321, i need to reverse it to 123

a=int(input(‘Enter the number to be reversed=’))
rev=0
if (a==0):

``````else:
```````while (a>0):
```````dig=a%10
```````rev=rev*10+dig
```````a=a//10
```````print(‘the reversed number is’,rev')
`````````

Ah, so you want the digits in reverse order. Personally I’d skip the int conversion at the beginning and reverse the characters in the string from `input()`. The code still isn’t in a proper code block, though. You only need the triple backticks to start and end the block, you need to copy the part in between as-is.