Python interview questions and answers: Functional Programming
Python: Lambda Functions, Map, Filter
Table of Contents :
Lambda Functions:
- What is a lambda function in Python, and how is it defined?
- Describe how lambda functions differ from regular functions in terms of syntax.
- How do you use lambda functions as arguments to higher-order functions like map, filter, and sorted?
Map, Filter, and Reduce Functions:
- What is the purpose of Python's map function?
- What does the Python filter function do, and how is it used?
- What is the reduce function, and what does it do?
- How is the reduce function different from map and filter?
List Comprehensions:
- What are Python list comprehensions? Explain the syntax and example of a list comprehension.
- How are list comprehensions different from using loops to generate lists?
- Provide an example of using a list comprehension to create a new list based on an existing list.
- Can list comprehensions include conditional expressions? If yes, how are they used?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics