Overview
Project details
A project to teach and implement lambda functions in Python.
Specifications
Objective:
Create a series of exercises and examples to demonstrate the use of lambda functions in Python.
Context:
The project should include various scenarios where lambda functions can be applied, such as sorting lists, filtering data, and using them with higher-order functions like map and filter. Additionally, provide explanations and use cases for each example to enhance understanding.
Tracks: Python
155
number of points you will earn
2
launches to complete the project
4
tasks to complete the project
This project is part of the following tracks:
Learning outcomes
Understanding of lambda functions, practical applications in data manipulation, and familiarity with higher-order functions in Python.
Project Launches & Tasks
launch_1
-
task_1 (25 points)
- Create a function called
sort_list
that takes a list of integers as an argument. - The function should return the list sorted in ascending order using a lambda function.
- Implement this function in
utils/sorting.py
. - Add or update unit tests for
sort_list
intests/test_sorting.py
. - Do not forget to implement unit tests for
sort_list
function
- Create a function called
-
task_2 (35 points)
- Implement a function called
filter_even_numbers
that takes a list of integers and returns a new list containing only the even numbers using a lambda function. - This function should be located in
utils/filtering.py
. - Add or update unit tests for
filter_even_numbers
intests/test_filtering.py
. - Do not forget to implement unit tests for
filter_even_numbers
function
- Implement a function called
launch_2
-
task_3 (45 points)
- Create a function called
map_square
that takes a list of integers and returns a new list with the squares of each number using a lambda function withmap
. - This function should be implemented in
utils/mapping.py
. - Add or update unit tests for
map_square
intests/test_mapping.py
. - Do not forget to implement unit tests for
map_square
function
- Create a function called
-
task_4 (50 points)
- Implement a function called
sort_by_length
that takes a list of strings and returns the list sorted by the length of each string using a lambda function. - This function should be located in
utils/sort_by_length.py
. - Add or update unit tests for
sort_by_length
intests/test_sort_by_length.py
. - Do not forget to implement unit tests for
sort_by_length
function
- Implement a function called