#include #include "simple_functions.hpp" static PyObject* is_even_wrapper(PyObject* self, PyObject* args) { long long number; if (!PyArg_ParseTuple(args, "L", &number)) { return NULL; } return PyBool_FromLong(simple_functions::is_even(number)); } static PyObject* is_odd_wrapper(PyObject* self, PyObject* args) { long long number; if (!PyArg_ParseTuple(args, "L", &number)) { return NULL; } return PyBool_FromLong(simple_functions::is_odd(number)); } static PyMethodDef SimpleFunctionsMethods[] = { {"is_even", is_even_wrapper, METH_VARARGS, "Check if a number is even"}, {"is_odd", is_odd_wrapper, METH_VARARGS, "Check if a number is odd"}, {NULL, NULL, 0, NULL} }; static struct PyModuleDef simple_functions_module = { PyModuleDef_HEAD_INIT, "simple_functions", "Module for checking if numbers are even or odd", -1, SimpleFunctionsMethods }; PyMODINIT_FUNC PyInit_simple_functions(void) { return PyModule_Create(&simple_functions_module); }