w3resource

Python Lambda - Exercises, Practice, Solution

Python Lambda [23 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts.]

1. Write a Python program to create a lambda function that adds 15 to a given number passed in as an argument, also create a lambda function that multiplies argument x with argument y and print the result. Go to the editor
Click me to see the sample solution

2. Write a Python program to create a function that takes one argument, and that argument will be multiplied with an unknown given number. Go to the editor
Click me to see the sample solution

3. Write a Python program to sort a list of tuples using Lambda.
Click me to see the sample solution

4. Write a Python program to sort a list of dictionaries using Lambda. Go to the editor
Click me to see the sample solution

5. Write a Python program to filter a list of integers using Lambda. Go to the editor
Click me to see the sample solution

6. Write a Python program to square and cube every number in a given list of integers using Lambda. Go to the editor
Click me to see the sample solution

7. Write a Python program to find if a given string starts with a given character using Lambda. Go to the editor
Click me to see the sample solution

8. Write a Python program to extract year, month, date and time using Lambda. Go to the editor
Click me to see the sample solution

9. Write a Python program to check whether a given string is number or not using Lambda. Go to the editor
Click me to see the sample solution

10. Write a Python program to create Fibonacci series upto n using Lambda. Go to the editor
Click me to see the sample solution

11. Write a Python program to find intersection of two given arrays using Lambda. Go to the editor
Click me to see the sample solution

12. Write a Python program to rearrange positive and negative numbers in a given array using Lambda. Go to the editor
Click me to see the sample solution

13. Write a Python program to count the even, odd numbers in a given array of integers using Lambda. Go to the editor
Click me to see the sample solution

14. Write a Python program to find the values of length six in a given list using Lambda. Go to the editor
Click me to see the sample solution

15. Write a Python program to add two given lists using map and lambda. Go to the editor
Click me to see the sample solution

16. Write a Python program to find the second lowest grade of any student(s) from the given names and grades of each student using lists and lambda. Input number of students, names and grades of each student. Go to the editor
Click me to see the sample solution

17. Write a Python program to find numbers divisible by nineteen or thirteen from a list of numbers using Lambda. Go to the editor
Click me to see the sample solution

18. Write a Python program to find palindromes in a given list of strings using Lambda. Go to the editor
Click me to see the sample solution

19. Write a Python program to find all anagrams of a string in a given list of strings using lambda. Go to the editor
Click me to see the sample solution

20. Write a Python program to find the numbers of a given string and store them in a list, display the numbers which are bigger than the length of the list in sorted form. Use lambda function to solve the problem. Go to the editor
Click me to see the sample solution

21. Write a Python program that multiply each number of given list with a given number using lambda function. Print the result. Go to the editor
Click me to see the sample solution

22. Write a Python program that sum the length of the names of a given list of names after removing the names that starts with an lowercase letter. Use lambda function. Go to the editor
Click me to see the sample solution

23. Write a Python program that removes the positive numbers from a given list of numbers. Sum the negative numbers and print the absolute value using lambda function. Print the result. Go to the editor
Click me to see the sample solution

Python Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

Test your Python skills with w3resource's quiz


Python: Tips of the Day

Python: Unknown Arguments Using *arguments

If your function can take in any number of arguments then add a * in front of the parameter name:

def myfunc(*arguments):
 for a in arguments:
   print a
myfunc(a)
myfunc(a,b)
myfunc(a,b,c)