Jan-24-2019, 01:57 PM
def COLLATZ(NUM): if NUM == 1: return NUM elif (NUM%2 == 0): NUM = NUM/2 print(NUM) COLLATZ(NUM) else: (NUM%3) == 1 NUM = (NUM*3)+1 print(NUM) COLLATZ(NUM) print("Enter Number") N = int(input()) NN = COLLATZ(N) print("Enter the last Value", NN)1. In the last iteration NUM becomes 1 and it should return NUM. Apparently it is returning None. Can someone please explain the logic behind None ?