Why can't I see the result of the function when I use range()
? I want to create a range of numbers where each the number will be evaluate in "colla" function. But range doesn't work with "colla"
def colla(num):
fin = []
while num != 1:
if num % 2 == 0:
num = num // 2
fin.append(0)
elif num % 2 == 1:
num = 3 * num + 1
fin.append(1)
counter = []
for Z in fin:
if Z == 0:
counter.append(Z)
return ("{:.0%}".format((len(counter)/len(fin))))
for i in range(5):
print(colla(i)) # here I have a problem!