Filter vowels from String using filter() method in Python
Write a Python program to filter all vowels from string using filter()
method in Python.
pgm.py
a=list("sample") def vowel(x): v=('a','e','i','o','u') return x in v b=list(filter(vowel,a)) print("Vowels : ",b) print("No of Vowels : ",len(b))
Vowels : ['a', 'e'] No of Vowels : 2