w3resource

Python Lambda - Exercises, Practice, Solution

Python Lambda [41 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 to calculate the sum of the positive and negative numbers of a given list of numbers using lambda function. Go to the editor
Click me to see the sample solution

24. Write a Python program to find numbers within a given range where every number is divisible by every digit it contains. Go to the editor
Click me to see the sample solution

25. Write a Python program to create the next bigger number by rearranging the digits of a given number. Go to the editor
Click me to see the sample solution

26. Write a Python program to find the list with maximum and minimum length using lambda. Go to the editor
Click me to see the sample solution

27. Write a Python program to sort each sublist of strings in a given list of lists using lambda. Go to the editor
Click me to see the sample solution

28. Write a Python program to sort a given list of lists by length and value using lambda. Go to the editor
Click me to see the sample solution

29. Write a Python program to find the maximum value in a given heterogeneous list using lambda. Go to the editor
Click me to see the sample solution

30. Write a Python program to sort a given matrix in ascending order according to the sum of its rows using lambda. Go to the editor
Click me to see the sample solution

31. Write a Python program to extract specified size of strings from a give list of string values using lambda. Go to the editor
Click me to see the sample solution

32. Write a Python program to count float number in a given mixed list using lambda. Go to the editor
Click me to see the sample solution

33. Write a Python program to check whether a given string contains a capital letter, a lower case letter, a number and a minimum length using lambda. Go to the editor
Click me to see the sample solution

34. Write a Python program to filter the height and width of students, which are stored in a dictionary using lambda. Go to the editor
Click me to see the sample solution

35. Write a Python program to check whether a specified list is sorted or not using lambda. Go to the editor
Click me to see the sample solution

36. Write a Python program to extract the nth element from a given list of tuples using lambda. Go to the editor
Click me to see the sample solution

37. Write a Python program to sort a list of lists by a given index of the inner list using lambda. Go to the editor
Click me to see the sample solution

38. Write a Python program to remove all elements from a given list present in another list using lambda. Go to the editor
Click me to see the sample solution

39. Write a Python program to find the elements of a given list of strings that contain specific substring using lambda. Go to the editor
Click me to see the sample solution

40. Write a Python program to find the nested lists elements, which are present in another list using lambda. Go to the editor
Click me to see the sample solution

41. Write a Python program to reverse strings in a given list of string values using lambda. 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: List Slicing Tricks

list[start:stop:step]

x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
x[0:3]

Output:

[1, 2, 3]
x[3:]

Output:

[4, 5, 6, 7, 8, 9]
x[:6]

Output:

[1, 2, 3, 4, 5, 6]
x[0:6:2]

Output:

[1, 3, 5]
x[:-3]

Output:

[1, 2, 3, 4, 5, 6]
x[::-1]

Output:

[9, 8, 7, 6, 5, 4, 3, 2, 1]
x[-3::-1]

Output:

[7, 6, 5, 4, 3, 2, 1]