Composition in functions:
- The composition function is used to execute expression and get an expression from the user.
- Using eval() function and full form evaluate value through function.
- The value returned by a function may be used as an argument for another function in a nested manner. This is called composition.
- For example, if we wish to take a numeric value or an expression as an input from the user, we take the input string from the user using the function input() and apply eval() function to evaluate its value.
Example program for print the set of elements:
Output:
No comments:
Post a Comment