Jump to content

How to add function as Value in dictionary in python


elena florence

Recommended Posts

I have another .python file where all functions are written, e.g.

def EqualToCheck(value, comparingValue, ExpectedVal:bool):

if (value == comparingValue):

return ExpectedVal

else :

return not ExpectedVal

 

def LessThanCheck(value, comparingValue, ExpectedVal:bool):

if (value < comparingValue):

return ExpectedVal

else :

return not ExpectedVal

I want to call these functions from another py file where I want to call these functions if my data has a certain string. e.g.

callFunc = {

"checkEqual" : EqualToCheck(5,6,True),

"lessthanEqual" : LessThanCheck(5,6,True)

}

How can I do it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...