In python, the values that evaluate to False are considered Falsy values. The values are False, None, 0 and "".
Here, we are implementing a python program to remove the falsy values from a string. To remove these values we are using filter() method, it will filter out the falsy values.
Example:
Input:
[10, 20, 0, 30, 0, None]
Output:
[10, 20, 30]
Input:
[False, None, 0, "", "Hello", 10, "Hi!"]
Output:
['Hello', 10, 'Hi!']
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer