我很抱歉,如果这是非常基本的,我是编程的新手.当我运行我的代码时,只打印最后一个值.如何修改我的代码,以便使用while循环显示范围N中的整个列表?
x0 = 100 p = 5 N = 4 i = 0 x = [] while i <=N: i += 1 xn = ((1 + (p/100))**i)*x0 x.append(xn) print(x)
python loops while-loop
loops ×1
python ×1
while-loop ×1