5 - The Mighty Function

python
Published

May 11, 2026

In functional programming, functions can be pure or not pure. If a function is pure, the same input always provide the same result (deterministic).

import random
def validate_input(*args: int) -> bool:
    """helper function to validate input values are positive"""
    return any(x <= 0 for x in args)

def main() -> None:
    result = validate_input(1, 2, 3, 4, 5, 3)
    print(result)

if __name__ == "__main__":
    main()
False