diff --git a/README.md b/README.md index 2367cd7d3..ceeffb853 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ chunk([1,2,3,4,5],2) # [[1,2],[3,4],5] ``` + ### compact Removes falsey values from a list. @@ -89,6 +90,7 @@ compact([0, 1, False, 2, '', 3, 'a', 's', 34]) # [ 1, 2, 3, 'a', 's', 34 ] ``` + ### count_occurences :information_source: Already implemented via `list.count()`. @@ -116,6 +118,7 @@ count_occurrences([1, 1, 2, 1, 2, 3], 1) # 3 ``` + ### deep_flatten Deep flattens a list. @@ -152,6 +155,7 @@ deep_flatten([1, [2], [[3], 4], 5]) # [1,2,3,4,5] ``` + ### difference Returns the difference between two arrays. @@ -175,6 +179,7 @@ difference([1, 2, 3], [1, 2, 4]) # [3] ``` + ### shuffle :information_source: The same algorithm is already implemented via `random.shuffle`. @@ -211,6 +216,7 @@ 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. @@ -239,6 +245,7 @@ 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()` @@ -272,6 +279,7 @@ zip(['a'], [1, 2], [True, False], fill_value = '_') # [['a', 1, True], ['_', 2, ``` + ## :scroll: String ### count_vowels @@ -301,6 +309,7 @@ count_vowels('gym') # 0 ``` + ## :heavy_division_sign: Math ### gcd @@ -350,6 +359,7 @@ gcd(8,36) # 4 ``` + ### lcm Returns the least common multiple of two or more numbers. @@ -399,6 +409,7 @@ 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). @@ -429,6 +440,7 @@ 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). @@ -459,6 +471,7 @@ min_n([1, 2, 3], 2) # [1,2] ``` + ## Credits *Icons made by [Smashicons](https://www.flaticon.com/authors/smashicons) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/).* diff --git a/scripts/readme.py b/scripts/readme.py index 46b049756..65f0f8e4e 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' + '\n' open("README.md",'w').write(start+toAppend+'\n'+end)