Hi Everyone,
I am new to both Python and SPOJ. I hope that I can find some helps here 
I have tried "The 3n plus 1 problem" (spoj.pl/problems/PROBTNPO/) for today, but the result is always NZEC.
Here is my code
import string
def cycle(x):
result=1
while (x!=1):
if (x%2==1):
x=(3*x)+1
elif (x%2==0):
x=x/2
result+=1
return result
def main():
data=raw_input()
while data!=" ":
p=data.find(" ")
a=int(data[0:p])
b=int(data[(p+1):len(data)])
result=0
for i in range(b-a+1):
result=result+cycle(i+a)
print result
data=raw_input()
return 0
main()
I do not know where it goes wrong. Can someone help me?