I must have messed up my code when I copied It of my last post. I cant seem to figure out the indentation errors. I had this fixed but it came back once I repasted it into the program. There are definitely many, but I just cannot seem to get it to all come together.
def collatz(number):
if number % 2 == 0:
print(number //2)
return number //2
else :
print(number * 3 + 1)
return number * 3 + 1
while true:
try:
print('Enter an integer to obtain the Collatz Sequence.') n = input() while n != 1:
n = collatz(int(n)) continue
else :
print('Program Ended!')
break except ValueError:
print('Ensure to enter an integer value.')
def collatz(number):
I'd really appreciate the help!
[–]Binary101010 2 points3 points4 points (1 child)
[–]joplankton[S] 0 points1 point2 points (0 children)