0

Hey guys...

I am working on a program where when a user enters a number, the program adds all the digits of the number and goes on till the sum is single digit.

Example:

9812737

= 9 + 8 + 1 + 2 + 7 + 3 +7

= 37

= 3 + 7

= 10

= 1 + 0

=1

So, here goes:

```
def reduce():
s=raw_input("Enter a number: ")
x=int(s)
p=0
for i in s:
p+=x%10
x=x/10
return p and x
reduce()
if(p>9):
reduce()
print(p)
```