Python Program # Python3 code to demonstrate# Matrix Product# Using chain() + loop

Опубликовано: 06 Ноябрь 2022
на канале: Tech Tips
9
0

Python3 code to demonstrate
Matrix Product
Using chain() + loop
from itertools import chain

getting Product


def prod(val):
res = 1
for ele in val:
res *= ele
return res


initializing list
test_list = [[1, 4, 5], [7, 3], [4], [46, 7, 3]]

printing original list
print("The original list : " + str(test_list))

using chain() + loop
Matrix Product
res = prod(list(chain(*test_list)))

print result
print("The total element product in lists is : " + str(res))
Output :
The original list : [[1, 4, 5], [7, 3], [4], [46, 7, 3]]
The total element product in lists is : 1622880


На этой странице сайта вы можете посмотреть видео онлайн Python Program # Python3 code to demonstrate# Matrix Product# Using chain() + loop длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Tech Tips 06 Ноябрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 9 раз и оно понравилось 0 зрителям. Приятного просмотра!