我是python的初学者(一周)。在这里,我正在尝试打印 60 的所有主要因子的列表。但是对于第 19 行,我收到以下错误: TypeError: unsupported operand type(s) for %: 'float' and 'list'
编码:
whylist = []
factor = []
boom = []
primefactor = []
n = 60
j = (list(range(1, n, 1)))
for numbers in j:
if n%numbers == 0:
whylist.append(numbers)
for everynumber in whylist:
factor.append(everynumber)
for things in factor:
u = (list(range(1, things, 1)))
d = float(things)
if d%u == 0:
boom.append(things)
if len(boom) == 1:
for every in boom:
primefactor.append(every)
print(primefactor)
我究竟做错了什么?