add cpntributor_database

This commit is contained in:
Rohit Tanwar
2018-02-20 14:39:09 +05:30
parent d04f0260fc
commit 9e26f0ba73
139 changed files with 12881 additions and 12857 deletions

View File

@ -1,15 +1,15 @@
### palindrome
Returns `True` if the given string is a palindrome, `False` otherwise.
Convert string `str.lower()` and use `re.sub` to remove non-alphanumeric characters from it. Then compare the new string to the reversed.
```python
def palindrome(string):
from re import sub
s = sub('[\W_]', '', string.lower())
return s == s[::-1]
```
```python
palindrome('taco cat') # True
### palindrome
Returns `True` if the given string is a palindrome, `False` otherwise.
Convert string `str.lower()` and use `re.sub` to remove non-alphanumeric characters from it. Then compare the new string to the reversed.
```python
def palindrome(string):
from re import sub
s = sub('[\W_]', '', string.lower())
return s == s[::-1]
```
```python
palindrome('taco cat') # True
```