end = 20
temp = [num for num in range(2,end+1)]
n = len(temp)
for index_1 in range(n):
num = temp[index_1] # 將其作爲被除數
for index_2 in range(index_1+1,n):
if temp[index_2]%num == 0 and num != 1:
temp[index_2] /= num
s = 1
for num in temp:
s *= num
print(s)
反正問題是解決了,以後看看有沒有簡潔的方法。