Collatz sequence, how should None be disposed of in the final return value

beginners need to write Collatz sequences when learning Python, chapters, and then write such code themselves

< H1 > this is a code exercise about Collatz sequences < / H1 >

print ("Enter number:")
def Collatz ():

try:
    num = int(input())
    while num !=1 :
        if num %2 == 0:
            num = num // 2
            print(num)
        elif num %2 == 1:
            num = 3*num+1
            print(num)
except ValueError:
    print("Error! Please Enter number")

print (Collatz ())

Enter number:
5
16
8
4
2
1
None

None, appears unexpectedly in the return value above. I want to ask which point in the code caused this None, and how should it be removed?
having tried if num = = 1 sys.exit breakbreakor calling

before will not solve the problem.
Mar.30,2021

because of your sentence:

print(collatz())

collatz as a function, it returns None by default if no value is returned. This None is printed out by the print () function.
so you can just do this:

collatz()
Menu