Masked Product X57176


Statement
 

pdf   zip   main.py

thehtml

Write a function prodmask(s, m) that receives two lists of integers s and m, of the same length, and returns the product of all the values s[i] such that m[i] is odd.

Sample session
>>> prodmask([2, 3, 4, 5, 6], [1, 5, 1, 3, 1])
720
>>> prodmask([2, 3, 4, 5, 6], [0, 0, 4, 11, 0])
5
>>> prodmask([1234], [0])
1
>>> prodmask([1234], [1])
1234
>>> prodmask([], [])
1
Information
Author
José Luis Balcázar
Language
English
Official solutions
Python
User solutions
Python