pass a function as a class function through a constructor in python

{print("Hello")} is a set containing the element None. Your code expects a function in that place. If you want to pass a function containing the statement print("Hello"), you could use:

lambda *args: print("Hello")

This defines a function that will accept any number of positional arguments and print “Hello”.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top