Summing Digits
while 1:
try:
a=str(input())
if a=='0':
break
while int(a)>=10:
count=0
for i in range(len(a)):
count+=int(a[i])
a=str(count)
print(a)
except:
break
Parity
while 1:
try:
a=int(input())
if a==0:
break
b=str(bin(a))
count=0
for i in b:
if i=='1':
count+=1
print('The parity of '+str(b[2:])+' is '+str(count)+' (mod 2).')
except:
break