Python function that computes the product of odd digits in a positive integer, returning 0 if none.
# Source: https://github.com/sickn33/agentic-awesome-skills | License: MIT | Copyright 2026 Antigravity User
# Provided via justclaw.it.com; keep this notice with the code.
# HumanEval/131
# Loki Mode Multi-Agent Solution
# Attempts: 1
# Passed: True
def digits(n):
"""Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
digits(1) == 1
digits(4) == 0
digits(235) == 15
"""
product = 1
has_odd = False
while n > 0:
digit = n % 10
if digit % 2 == 1:
product *= digit
has_odd = True
n //= 10
return product if has_odd else 0
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key