python不会运行这个程序;说语法错误

时间:2017-04-30 12:30:57

标签: python syntax

n = int(input())
s = 1000000
a = []
for i in range(n):
  a.append(int(input())
for i in range(0,(n-16)):
  for k in range(15,(n-16)):
    if (a[i]*a[i+k]) <= s:
      s = a[i]*a[i+k]
print(s)

该计划不会运行。冒号被认为是错误,以及&a; s = a [i] * a [i + k]&#39;串。需要帮助!

1 个答案:

答案 0 :(得分:0)

你应该关闭第二个输入的括号

n = int(input())
s = 1000000
a = []
for i in range(n):
  a.append(int(input()) <<<<<<<<<<<<<<<< here
for i in range(0,(n-16)):
  for k in range(15,(n-16)):
    if (a[i]*a[i+k]) <= s:
      s = a[i]*a[i+k]
print(s)