因此,我寫了這段代碼,但它似乎不起作用。循環(1 + x + x ** 2 + x ** 3 + x ** 4 .... n)不起作用
x=1
sum1=0
n=int(input("enter how long the series should be"))
print (x)
for a in range (1,n):
sum1=sum1+(sum1**a)
print(sum1)
a=a+1
print("the sum of the series is",sum1)
輸出是:你不使用你的輸入x
enter how long the series should be5
1
0
0
0
0
the sum of the series is 0
>>>
你並不需要增加'了' –
你不想'X **了'? – jtbandes
謝謝大家。 –