Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def arrayOddProduct(arr):
- """Returns a product of odd elements in array arr."""
- s = 1
- for a in arr:
- if ??: # REPLACE ??
- s *= a
- return s
- if __name__ == "__main__":
- arr = [1,2,3,4,5,6,7]
- result = arrayOddProduct(arr)
- expected = 105
- assert result == expected, ("product of array %s must be %d, but it is %d" % (arr, expected, result))
Advertisement
Add Comment
Please, Sign In to add comment