numbers = [1, 2, -3, 4, -5, 6, 7]
max_number = max(abs(number) for number in numbers)
min_number = min(abs(number) for number in numbers)
max_index = numbers.index(max_number)
min_index = numbers.index(min_number)
if min_index < max_index:
left_number = min_number
right_number = max_number
else:
left_number = max_number
right_number = min_number
between_numbers = numbers[min_index+1:max_index]
product = 1
for number in between_numbers:
product *= number
print(f'Произведение чисел между {left_number} и {right_number} равно {product}')
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
numbers = [1, 2, -3, 4, -5, 6, 7]
max_number = max(abs(number) for number in numbers)
min_number = min(abs(number) for number in numbers)
max_index = numbers.index(max_number)
min_index = numbers.index(min_number)
if min_index < max_index:
left_number = min_number
right_number = max_number
else:
left_number = max_number
right_number = min_number
between_numbers = numbers[min_index+1:max_index]
product = 1
for number in between_numbers:
product *= number
print(f'Произведение чисел между {left_number} и {right_number} равно {product}')