add n_times_string snippet

This commit is contained in:
lazargugleta
2019-09-27 09:07:25 +02:00
parent 6154b16700
commit 2b235f8c1d
4 changed files with 77 additions and 0 deletions

View File

@@ -117,6 +117,7 @@
* [`decapitalize`](#decapitalize)
* [`is_anagram`](#is_anagram)
* [`kebab`](#kebab)
* [`n_times_string`](#n_times_string)
* [`palindrome`](#palindrome)
* [`snake`](#snake)
* [`split_lines`](#split_lines)
@@ -1787,6 +1788,28 @@ kebab('AllThe-small Things'); # "all-the-small-things"
<br>[⬆ Back to top](#contents)
### n_times_string
Prints out the same string a defined number of times.
Use this method to print out the same string n number of times.
```py
def n_times_string(string,n):
return (string * n)
```
<details>
<summary>Examples</summary>
```py
n_times_string('py', 4) #'pypypypy'
```
</details>
<br>[⬆ Back to top](#contents)
### palindrome
Returns `True` if the given string is a palindrome, `False` otherwise.