"""
Practice Projects
Page 76
"""

import time


def collatz(number):
    if number % 2 == 0:
        res = int(number / 2)
    else:
        res = 3 * number + 1
    print(res)
    return res


def cli():
    print("Ingresa un número entero:", end=" ")
    number = input()
    try:
        number = int(number)
        wait = 0.1 / len(str(number))
        while number != 1:
            number = collatz(number)
            time.sleep(wait)
    except ValueError:
        print(f"¡'{number}' no es un número entero!")
        cli()


cli()
