fork download
  1. # your code goes here
  2. from random import randint
  3. from functools import reduce
  4. import operator
  5. list_length = int(input('Enter number count: '))
  6. numbers = [randint(-100,100) for _ in range(list_length)]
  7. sum_positive = sum([number for number in numbers if number>0])
  8. minimum_index = numbers.index(min(numbers))
  9. maximum_index = numbers.index(max(numbers))
  10. left,right = sorted([minimum_index, maximum_index])
  11. product = reduce(operator.mul, numbers[left+1:right],1)
  12. print(numbers)
  13. print(sum_positive, product)
Success #stdin #stdout 0.02s 12776KB
stdin
5
stdout
Enter number count: [-6, -33, -37, 54, -9]
54 1