﻿ Python: Find whether a given string starts with a given character using Lambda - w3resource # Python: Find whether a given string starts with a given character using Lambda

## Python Lambda: Exercise-7 with Solution

Write a Python program to find whether a given string starts with a given character using Lambda.

Sample Solution:

Python Code :

``````starts_with = lambda x: True if x.startswith('P') else False
print(starts_with('Python'))
starts_with = lambda x: True if x.startswith('P') else False
print(starts_with('Java'))
``````

Sample Output:

```True
False
```

## 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]
```