This may be a silly question. I just created a function that divide a number and give remainder if the number is even else do some other mathematical operations in python.
def collataz(number):
if number % 2 == 0:
output = number // 2
return int(output)
else:
output = 3 * number + 1
return int(output)
import sys
try:
c = collataz(int(input("Enter int")))
while c.output != 1:
print(c)
except KeyboardInterrupt:
sys.exit()
But when I run this code it gives this following error after asking for input 'int' object has no attribute 'output'
how can I fix this? and please also tell the reason why my code give this error so I can understand the problem. Please tell if something is not clear.
Thanks,