﻿ Python: Find the values of length six in a given list using Lambda - w3resource

# Python: Find the values of length six in a given list using Lambda

## Python Lambda: Exercise-14 with Solution

Write a Python program to find the values of length six in a given list using Lambda.

Sample Solution:

Python Code :

``````weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
days = filter(lambda day: day if len(day)==6 else '', weekdays)
for d in days:
print(d)
``````

Sample Output:

```Monday
Friday
Sunday
```

## Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Returns all the elements of a list except the last one

Example:

```def tips_initial(lst):
return lst[0:-1]

print(tips_initial([1, 2, 3, 4]))
```

Output:

```[1, 2, 3]
```