while循环中的数字乘法

multiplication of numbers from while loop

我正在尝试乘以从 while 循环中得到的数字。 像 1.1 * 1.2 * 1.3 ... * 2 - 数字从 1.1 开始到 2 结束 我已经这样做了,但它给了我 4.41 而不是 67.04,这是什么问题?我需要使用 for 循环编写它吗? 脚本:

count = 1.1

while count < 2.1:
    print(count)
    count += 0.1

print(round(count * count, 3))

我添加了一个 final_product 变量,它将乘以每个更新的计数值,也许这可以帮助:

count = 1.1
final_product = 1
while count < 2.1:
    print(count)
    final_product*=count
    count += 0.1
print(round(final_product, 2))

你做的一切都很完美,但你需要添加一些东西来捕获新的更新值(乘以 0.1)并乘以自身以获得最终产品,即 67.04。

out = 1
for i in range(11,21):
    out *= i/10

print(out)

输出:

67.04425728