# python 3+
x = [1, 3, 5, 7, 9]
z = 1
for num in x: z *= num
print(z)
# альтернативный вариант:
from functools import reduce
print(reduce(lambda x, y: x*y, x))
# out: 945
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
# python 3+
x = [1, 3, 5, 7, 9]
z = 1
for num in x: z *= num
print(z)
# альтернативный вариант:
from functools import reduce
print(reduce(lambda x, y: x*y, x))
# out: 945