diff --git a/projects/019-the-collatz-conjecture/python/main.py b/projects/019-the-collatz-conjecture/python/main.py index e69de29..2b9d8e0 100644 --- a/projects/019-the-collatz-conjecture/python/main.py +++ b/projects/019-the-collatz-conjecture/python/main.py @@ -0,0 +1,18 @@ +sequence = 1 + +while sequence > 0: + sequence = int(input('insert an integer: ')) + + while sequence > 1: + is_even = sequence % 2 + + if is_even == 0: + sequence = sequence // 2 + print(sequence) + + else: + sequence = sequence * 3 + 1 + print(sequence) + + +