pub-3785248829033902 | Python: Functions as arguments | - Big data with Python

| Python: Functions as arguments |

Functions can also be used as arguments of other functions.



The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of the Function statement in Python:

Æ’ python command

def i(x, y):
  return x + y

def ii(func, x, y):
  return func(func(x, y), func(x, y))

x = 2
y = 3

print(ii(i, x, y))

output

10          


Previous
Next Post »