和提示答案一樣為什么報錯?
x1 = 1
d = 3
n = 100
x100 = d*(n-1)+x1
s = (x1+x100)*n/2
print s
File "index.py", line 4
SyntaxError: Non-ASCII character '\xef' in file index.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
2020-01-04
是因為你的括號是在中文條件下的,你換成英文條件下的括號,就OK啦~