hidden examples
This commit is contained in:
26
README.md
26
README.md
@ -67,6 +67,8 @@ chunk([1,2,3,4,5],2) # [[1,2],[3,4],5]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### compact
|
### compact
|
||||||
|
|
||||||
Removes falsey values from a list.
|
Removes falsey values from a list.
|
||||||
@ -91,6 +93,8 @@ compact([0, 1, False, 2, '', 3, 'a', 's', 34]) # [ 1, 2, 3, 'a', 's', 34 ]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### count_occurences
|
### count_occurences
|
||||||
|
|
||||||
:information_source: Already implemented via `list.count()`.
|
:information_source: Already implemented via `list.count()`.
|
||||||
@ -119,6 +123,8 @@ count_occurrences([1, 1, 2, 1, 2, 3], 1) # 3
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### deep_flatten
|
### deep_flatten
|
||||||
|
|
||||||
Deep flattens a list.
|
Deep flattens a list.
|
||||||
@ -156,6 +162,8 @@ deep_flatten([1, [2], [[3], 4], 5]) # [1,2,3,4,5]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### difference
|
### difference
|
||||||
|
|
||||||
Returns the difference between two arrays.
|
Returns the difference between two arrays.
|
||||||
@ -180,6 +188,8 @@ difference([1, 2, 3], [1, 2, 4]) # [3]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### shuffle
|
### shuffle
|
||||||
|
|
||||||
:information_source: The same algorithm is already implemented via `random.shuffle`.
|
:information_source: The same algorithm is already implemented via `random.shuffle`.
|
||||||
@ -217,6 +227,8 @@ shuffle(foo) # [2,3,1] , foo = [1,2,3]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### spread
|
### spread
|
||||||
|
|
||||||
Implements javascript's spread syntax as a function. Flattens the list(non-deep) and returns an list.
|
Implements javascript's spread syntax as a function. Flattens the list(non-deep) and returns an list.
|
||||||
@ -246,6 +258,8 @@ spread([1,2,3,[4,5,6],[7],8,9]) # [1,2,3,4,5,6,7,8,9]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### zip
|
### zip
|
||||||
|
|
||||||
:information_source: Already implemented via `itertools.zip_longest()`
|
:information_source: Already implemented via `itertools.zip_longest()`
|
||||||
@ -280,6 +294,8 @@ zip(['a'], [1, 2], [True, False], fill_value = '_') # [['a', 1, True], ['_', 2,
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
## :scroll: String
|
## :scroll: String
|
||||||
|
|
||||||
### count_vowels
|
### count_vowels
|
||||||
@ -310,6 +326,8 @@ count_vowels('gym') # 0
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
## :heavy_division_sign: Math
|
## :heavy_division_sign: Math
|
||||||
|
|
||||||
### gcd
|
### gcd
|
||||||
@ -360,6 +378,8 @@ gcd(8,36) # 4
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### lcm
|
### lcm
|
||||||
|
|
||||||
Returns the least common multiple of two or more numbers.
|
Returns the least common multiple of two or more numbers.
|
||||||
@ -410,6 +430,8 @@ lcm([1, 3, 4], 5) # 60
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### max_n
|
### max_n
|
||||||
|
|
||||||
Returns the `n` maximum elements from the provided list. If `n` is greater than or equal to the provided list's length, then return the original list(sorted in descending order).
|
Returns the `n` maximum elements from the provided list. If `n` is greater than or equal to the provided list's length, then return the original list(sorted in descending order).
|
||||||
@ -441,6 +463,8 @@ max_n([1, 2, 3], 2) # [3,2]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
### min_n
|
### min_n
|
||||||
|
|
||||||
Returns the `n` minimum elements from the provided list. If `n` is greater than or equal to the provided list's length, then return the original list(sorted in ascending order).
|
Returns the `n` minimum elements from the provided list. If `n` is greater than or equal to the provided list's length, then return the original list(sorted in ascending order).
|
||||||
@ -471,6 +495,8 @@ min_n([1, 2, 3], 2) # [1,2]
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<a href = "#table-of-contents">:arrow_up: Back To Top</a>
|
||||||
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
@ -49,5 +49,5 @@ for category in tag_dict:
|
|||||||
someFile = open("snippets/" + snippet + '.md')
|
someFile = open("snippets/" + snippet + '.md')
|
||||||
fileData = someFile.read()
|
fileData = someFile.read()
|
||||||
codeParts = re.split(codeRe,fileData)
|
codeParts = re.split(codeRe,fileData)
|
||||||
toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'<details><summary>View Examples</summary>\n\n```py\n{codeParts[3]}\n```\n</details>\n' + '\n'
|
toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'<details><summary>View Examples</summary>\n\n```py\n{codeParts[3]}\n```\n</details>\n\n<a href = "#table-of-contents">:arrow_up: Back To Top</a>\n ' + '\n'
|
||||||
open("README.md",'w').write(start+toAppend+'\n'+end)
|
open("README.md",'w').write(start+toAppend+'\n'+end)
|
||||||
|
|||||||
Reference in New Issue
Block a user