@@ -9,23 +9,23 @@ def collatz(num):
99 Parameters 
1010 ---------- 
1111 num : int 
12-  The integer to run through  the sequence. 
12+  The integer that starts  the sequence. 
1313 """ 
1414 if  (num  ==  1 ): # CASE: '1' -- end recursion 
1515 print ("Sequence Complete!" )
1616
1717 else : # CASE: not '1' 
18-  if  (num  %  2  ==  0 ): ## CASE: Even  -- print and return num // 2 
18+  if  (num  %  2  ==  0 ): ## CASE: EVEN  -- print and return ( num // 2)  
1919 new_num  =  num  //  2 
20-  else : ## CASE: Odd  -- print and return 3 * number +1 
20+  else : ## CASE: ODD  -- print and return ( 3 * number +1)  
2121 new_num  =  3  *  num  +  1 
2222
2323 print (new_num )
2424 return  collatz (new_num )
2525
2626
2727
28- def  runner ():
28+ def  netrunner ():
2929 """ 
3030 Driver code of the program. 
3131 """ 
@@ -36,8 +36,11 @@ def runner():
3636
3737 except  ValueError :
3838 print ("Value Error! -- Please enter a positive or negative whole number." )
39-  runner ()
39+  netrunner ()
40+ 41+  except  RecursionError :
42+  print ("ZERO (booooo!)\n Please enter a positive or negative whole number." )
4043
4144
4245# Run program  
43- runner ()
46+ netrunner ()
0 commit comments