我无法解决 flake8 SyntaxError 并且虽然代码执行得很好。
没有注释的代码
import math
def answer(str_n):
sume = ((str_n * (str_n + 1)) / 2) * math.sqrt(2)
sume = int(sume)
return sume
def answer1(str_n):
sume = 0
for i in range(str_n + 1):
sume += math.floor(i * math.sqrt(2))
# print i,math.floor(i*math.sqrt(2))
return sume
print "Test answer:", answer(77)
print "Actual answer:", answer1(77)