What are higher-order functions?

0 votes
How to pass functions as parameters?
Jun 12 in Python by Nisa
• 1,090 points
18 views

1 answer to this question.

0 votes

Higher-order functions are those functions that either take a function as a parameter or return it as an output. They can be user-defined functions or built-in functions for example map(), filter(), reduce(), etc.

EXAMPLE:

def newfunc(a):
    return a*a
x = map(newfunc, (1,2,3,4))  #x is the map object
print(x)
print(set(x))

OUTPUT: 

<map object at 0x00000284B9AEADD8>
{16, 1, 4, 9}

In [9]:

answered Jul 25 by Fata
• 1,040 points

Related Questions In Python

0 votes
1 answer

what are "and" and "or" operators in Python?

AND - True if both the operands ...READ MORE

answered Apr 17, 2018 in Python by Johnathon
• 9,080 points
44 views
0 votes
1 answer

What are the differences between type() and isinstance()?

To summarize the contents of other (already ...READ MORE

answered Jun 4, 2018 in Python by ariaholic
• 7,340 points
42 views
0 votes
2 answers

What are the types of dictionary in python?

There are 4 types of dictionary Empty Integer Mixed Dictionary with ...READ MORE

answered Feb 14 in Python by Shashank
• 1,350 points
56 views
0 votes
1 answer

What are the key features of Python?

If it makes for an introductory language ...READ MORE

answered Jul 20, 2018 in Python by Priyaj
• 56,900 points
30 views
+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

answered Jul 25, 2018 in Python by Anmol
• 3,620 points
67 views
0 votes
1 answer

What are the differences between type() and is instance()?

Normally, in Python, you want your code ...READ MORE

answered Aug 6, 2018 in Python by Priyaj
• 56,900 points
27 views
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 56,900 points
242 views
0 votes
1 answer

what are sockets?

Sockets are basically open and close gateways ...READ MORE

answered Jun 25 in Python by Fata
• 1,040 points
23 views
0 votes
1 answer

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

answered May 28 in Python by Fata
• 1,040 points
37 views