How can i write a simple addition of values based on some rules/condition given which is boolean in python [closed]


enter image description here

The image attached is the requirement where i have to keep the condition or rules in a separate python file and have to access them in my for doing the operation.

Can someone help me in creating a function separately for these condition in a python file and accessing those in for performing the addition.

Source: Python Questions