diff --git a/README.md b/README.md index ad9270b8d..2367cd7d3 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ def chunk(arr, size): chunk([1,2,3,4,5],2) # [[1,2],[3,4],5] ``` -
+
### compact Removes falsey values from a list. @@ -88,7 +88,7 @@ def compact(arr): compact([0, 1, False, 2, '', 3, 'a', 's', 34]) # [ 1, 2, 3, 'a', 's', 34 ] ``` -
+
### count_occurences :information_source: Already implemented via `list.count()`. @@ -115,7 +115,7 @@ def count_occurences(arr, val): count_occurrences([1, 1, 2, 1, 2, 3], 1) # 3 ``` -
+
### deep_flatten Deep flattens a list. @@ -151,7 +151,7 @@ def deep_flatten(arr): deep_flatten([1, [2], [[3], 4], 5]) # [1,2,3,4,5] ``` -
+
### difference Returns the difference between two arrays. @@ -174,7 +174,7 @@ def difference(a, b): difference([1, 2, 3], [1, 2, 4]) # [3] ``` -
+
### shuffle :information_source: The same algorithm is already implemented via `random.shuffle`. @@ -210,7 +210,7 @@ foo = [1,2,3] shuffle(foo) # [2,3,1] , foo = [1,2,3] ``` -
+
### spread Implements javascript's spread syntax as a function. Flattens the list(non-deep) and returns an list. @@ -238,7 +238,7 @@ def spread(arg): spread([1,2,3,[4,5,6],[7],8,9]) # [1,2,3,4,5,6,7,8,9] ``` -
+
### zip :information_source: Already implemented via `itertools.zip_longest()` @@ -271,7 +271,7 @@ zip(['a'], [1, 2], [True, False]) # [['a', 1, True], [None, 2, False]] zip(['a'], [1, 2], [True, False], fill_value = '_') # [['a', 1, True], ['_', 2, False]] ``` -
+
## :scroll: String ### count_vowels @@ -300,7 +300,7 @@ count_vowels('foobar') # 3 count_vowels('gym') # 0 ``` -
+
## :heavy_division_sign: Math ### gcd @@ -349,7 +349,7 @@ def gcd(*args): gcd(8,36) # 4 ``` -
+
### lcm Returns the least common multiple of two or more numbers. @@ -398,7 +398,7 @@ lcm(12, 7) # 84 lcm([1, 3, 4], 5) # 60 ``` -
+
### 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). @@ -428,7 +428,7 @@ max_n([1, 2, 3]) # [3] max_n([1, 2, 3], 2) # [3,2] ``` -
+
### 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). @@ -457,7 +457,7 @@ min_n([1, 2, 3]) # [1] min_n([1, 2, 3], 2) # [1,2] ``` -
+
## Credits diff --git a/scripts/readme.py b/scripts/readme.py index f93e16834..46b049756 100644 --- a/scripts/readme.py +++ b/scripts/readme.py @@ -49,5 +49,5 @@ for category in tag_dict: someFile = open("snippets/" + snippet + '.md') fileData = someFile.read() codeParts = re.split(codeRe,fileData) - toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'
View Examples\n\n```py\n{codeParts[3]}\n```\n
' + '\n' + toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'
View Examples\n\n```py\n{codeParts[3]}\n```\n
' + '\n' open("README.md",'w').write(start+toAppend+'\n'+end)