task1.py 394 B

123456789101112131415161718
  1. import random
  2. arr=[random.randint(1,100) for i in range(6)]
  3. res=[-1,-1,None]
  4. print(arr)
  5. for i in range(len(arr)):
  6. if res[0]<1:
  7. res[0]=i
  8. else:
  9. if res[1]==-1:
  10. res[1]==i
  11. res[2]=arr[i-1]+arr[i]
  12. else:
  13. if arr[i-1]+arr[i]<res[2]:
  14. res[0]=i-1
  15. res[1]=i
  16. res[2]=arr[i-1]+arr[i]
  17. print(res)