задать массив m(10) случайными числами от 15 до 67 и найти сумму.
Утроить элементы массива,стоящие на чётных местах
найти максимальный элемент среди чётных положительных,заданных случайным образом от (-50,50)
СРОЧНО СРОЧНО
тема:ОДНОМЕРНЫЕ МАССИВЫ,ДАЮ 100 БАЛЛОВ
Ответы на вопрос
Ответил M0hlik
0
Here is a Python program that generates an array of 10 random numbers from 15 to 67, calculates the sum of the array, triples the elements at even indices, and finds the maximum element among even positive numbers:
import random
# Generate an array of 10 random numbers from 15 to 67
m = [random.randint(15, 67) for _ in range(10)]
# Calculate the sum of the array
array_sum = sum(m)
# Triple the elements at even indices
for i in range(0, len(m), 2):
m[i] *= 3
# Find the maximum element among even positive numbers
max_even_positive = max([x for x in m if x > 0 and x % 2 == 0])
print(m)
print(array_sum)
print(max_even_positive)
Новые вопросы
Литература,
1 год назад
Окружающий мир,
1 год назад
История,
1 год назад
Английский язык,
1 год назад
Қазақ тiлi,
7 лет назад