完成新手。当我运行以下它返回小数。如何让这个返回整数?
n = 17
while n != 1:
if (n % 2 == 0):
n = n/2
print(int(n))
else:
n = (3*n)+1
print(int(n))
结果:
py> python cold.py
52
26.0
13.0
40.0
20.0
10.0
5.0
16.0
8.0
4.0
2.0
1.0