ZERO-INDEX ARRAY

Added: 2025-09-13 07:30:50

Question Image

ZERO-INDEX ARRAY

Answer

✏️ Edit
import ast

def odd_or_even(strings, m):
    total = 0
    for word in strings:
        product_parity = 1  # assume odd
        for ch in word:
            if ord(ch) % 2 == 0:  # even ASCII → product is even
                product_parity = 0
                break
        total += product_parity  # add 1 if odd, 0 if even
    return "EVEN" if total % 2 == 0 else "ODD"


# --- Input from user ---
arr_line = input().strip()   # e.g. "['ace','oas','oas']"
m = int(input().strip())

# safely parse the Python-style list of strings
strings = ast.literal_eval(arr_line)

print(odd_or_even(strings, m))