change_case

This commit is contained in:
Rohit Tanwar
2018-01-16 17:43:47 +05:30
parent aede69f162
commit f3fd73f70e
3 changed files with 12 additions and 11 deletions

19
snippets/count_vowels.md Normal file
View File

@ -0,0 +1,19 @@
### count_vowels
Retuns `number` of vowels in provided `string`.
Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a string.
```python
import re
def count_vowels(str):
return len(len(re.findall(r'[aeiou]', str, re.IGNORECASE)))
```
``` python
count_vowels('foobar') # 3
count_vowels('gym') # 0
```