ASCIIsite/tests/control/dir/collatz.py
gabe 80d510a282 made auto-tester script.
tests against a known compiled file.
2022-01-09 22:52:39 -06:00

17 lines
364 B
Python
Executable file

def nextInSequence(number):
if isinstance(number, int):
if number % 2 == 0:
return number // 2
else:
return 3*number+1
else:
raise TypeError('input must be int!')
def seqenceLength(number):
length = 0
while number != 1:
number = nextInSequence(number)
length += 1
return length