nums=[1,2,7,0]
target=9
for i in nums:
for j in nums:
if i+j==target and nums.index(i)<nums.index(j):
return [nums.index(i),nums.index(j)]
File "<ipython-input-45-7bae4e6f6d77>", line 7
return [nums.index(i),nums.index(j)]
SyntaxError: 'return' outside function
都没有定义函数,你却用上了return。。。。。
往哪里return啊