add n_times_string snippet
This commit is contained in:
23
README.md
23
README.md
@ -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.
|
||||
|
||||
@ -807,6 +807,21 @@
|
||||
"hash": "c920b58f01c63346e65eab83a60c4635d4c104e41767b9d41ad94029e662b902"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "n_times_string",
|
||||
"type": "snippetListing",
|
||||
"title": "n_times_string",
|
||||
"attributes": {
|
||||
"text": "Prints out the same string a defined number of times.\n\nUse this method to print out the same string n number of times.\n\n\n",
|
||||
"tags": [
|
||||
"string",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "2d7a8e4505e3ad18e72464fa91c6bfe78592a5873c6202c0758b00f6daf11f8a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "none",
|
||||
"type": "snippetListing",
|
||||
|
||||
@ -1067,6 +1067,26 @@
|
||||
"hash": "c920b58f01c63346e65eab83a60c4635d4c104e41767b9d41ad94029e662b902"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "n_times_string",
|
||||
"title": "n_times_string",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "n_times_string.md",
|
||||
"text": "Prints out the same string a defined number of times.\n\nUse this method to print out the same string n number of times.\n\n\n",
|
||||
"codeBlocks": {
|
||||
"code": "def n_times_string(string,n):\r\n return (string * n)",
|
||||
"example": "n_times_string('py', 4) #'pypypypy'"
|
||||
},
|
||||
"tags": [
|
||||
"string",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "2d7a8e4505e3ad18e72464fa91c6bfe78592a5873c6202c0758b00f6daf11f8a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "none",
|
||||
"title": "none",
|
||||
|
||||
19
snippets/n_times_string.md
Normal file
19
snippets/n_times_string.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
title: n_times_string
|
||||
tags: string,beginner
|
||||
---
|
||||
|
||||
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)
|
||||
```
|
||||
|
||||
```py
|
||||
n_times_string('py', 4) #'pypypypy'
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user