diff --git a/README.md b/README.md
index e4c0e0f5c..fa72185db 100644
--- a/README.md
+++ b/README.md
@@ -23,25 +23,25 @@
View contents
### :scroll: String
-View contents
count_vowels
-byte_size
+View contents
@@ -307,6 +307,35 @@ compact([0, 1, False, 2, '', 3, 'a', 's', 34]) # [ 1, 2, 3, 'a', 's', 34 ]
:arrow_up: Back to top
+### count_by
+
+Groups the elements of a list based on the given function and returns the count of elements in each group.
+
+Use `map()` to map the values of the list using the given function. Iterate over the map and increase the the elements count each time it occurs.
+
+```py
+def count_by(arr, fn=lambda x: x):
+ key = {}
+ for el in map(fn, arr):
+ key[el] = 0 if not el in key else key[el]
+ key[el] += 1
+ return key
+
+ ```
+
+View Examples
+
+```py
+
+from math import floor
+count_by([6.1, 4.2, 6.3], floor) # {4: 1, 6: 2}
+count_by(['one', 'two', 'three'], len) # {3: 2, 5: 1}
+
+```
+
+
+
:arrow_up: Back to top
+
### count_occurences
:information_source: Already implemented via `list.count()`.
@@ -490,64 +519,8 @@ zip(['a'], [1, 2], [True, False], fill_value = '_') # [['a', 1, True], ['_', 2,
:arrow_up: Back to top
-### count_by
-
-Groups the elements of a list based on the given function and returns the count of elements in each group.
-
-Use `map()` to map the values of the list using the given function. Iterate over the map and increase the the elements count each time it occurs.
-
-```py
-def count_by(arr, fn=lambda x: x):
- key = {}
- for el in map(fn, arr):
- key[el] = 0 if not el in key else key[el]
- key[el] += 1
- return key
-
- ```
-
-View Examples
-
-```py
-
-from math import floor
-count_by([6.1, 4.2, 6.3], floor) # {4: 1, 6: 2}
-count_by(['one', 'two', 'three'], len) # {3: 2, 5: 1}
-
-```
-
-
-
:arrow_up: Back to top
-
## :scroll: String
-### count_vowels
-
-Retuns `number` of vowels in provided `string`.
-
-Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a string.
-
-```py
-import re
-
-
-def count_vowels(str):
- return len(len(re.findall(r'[aeiou]', str, re.IGNORECASE)))
-
- ```
-
-View Examples
-
-```py
-
-count_vowels('foobar') # 3
-count_vowels('gym') # 0
-
-```
-
-
-
:arrow_up: Back to top
-
### byte_size
Returns the length of a string in bytes.
@@ -619,6 +592,33 @@ capitalize_every_word('hello world!') # 'Hello World!'
:arrow_up: Back to top
+### count_vowels
+
+Retuns `number` of vowels in provided `string`.
+
+Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a string.
+
+```py
+import re
+
+
+def count_vowels(str):
+ return len(len(re.findall(r'[aeiou]', str, re.IGNORECASE)))
+
+ ```
+
+View Examples
+
+```py
+
+count_vowels('foobar') # 3
+count_vowels('gym') # 0
+
+```
+
+
+
:arrow_up: Back to top
+
### decapitalize
Decapitalizes the first letter of a string.
@@ -643,55 +643,6 @@ decapitalize('FooBar', True) # 'fOOBAR'
:arrow_up: Back to top
-### palindrome
-
-Returns `True` if the given string is a palindrome, `False` otherwise.
-
-Convert string `str.lower()` and use `re.sub` to remove non-alphanumeric characters from it. Then compare the new string to the reversed.
-
-```py
-def palindrome(string):
- from re import sub
- s = sub('[\W_]', '', string.lower())
- return s == s[::-1]
-
- ```
-View Examples
-
-```py
-
-palindrome('taco cat') # True
-
-```
-
-
-
:arrow_up: Back to top
-
-### is_upper_case
-
-Checks if a string is upper case.
-
-Convert the given string to upper case, using `str.upper()` method and compare it to the original.
-
-```py
-def is_upper_case(str):
- return str == str.upper()
-
- ```
-
-View Examples
-
-```py
-
-is_upper_case('ABC') # True
-is_upper_case('a3@$') # True
-is_upper_case('aB4') # False
-
-```
-
-
-
:arrow_up: Back to top
-
### is_lower_case
Checks if a string is lower case.
@@ -717,6 +668,55 @@ is_lower_case('Ab4') # False
:arrow_up: Back to top
+### is_upper_case
+
+Checks if a string is upper case.
+
+Convert the given string to upper case, using `str.upper()` method and compare it to the original.
+
+```py
+def is_upper_case(str):
+ return str == str.upper()
+
+ ```
+
+View Examples
+
+```py
+
+is_upper_case('ABC') # True
+is_upper_case('a3@$') # True
+is_upper_case('aB4') # False
+
+```
+
+
+
:arrow_up: Back to top
+
+### palindrome
+
+Returns `True` if the given string is a palindrome, `False` otherwise.
+
+Convert string `str.lower()` and use `re.sub` to remove non-alphanumeric characters from it. Then compare the new string to the reversed.
+
+```py
+def palindrome(string):
+ from re import sub
+ s = sub('[\W_]', '', string.lower())
+ return s == s[::-1]
+
+ ```
+View Examples
+
+```py
+
+palindrome('taco cat') # True
+
+```
+
+
+
:arrow_up: Back to top
+
## Credits
diff --git a/scripts/readme.py b/scripts/readme.py
index 14303d834..5f72333a6 100644
--- a/scripts/readme.py
+++ b/scripts/readme.py
@@ -38,13 +38,13 @@ tag_dict = tagger()
toAppend += '## Table of Contents \n'
for category in tag_dict:
toAppend = toAppend + '### ' + EMOJIS[category] + ' ' + title_case(category) +'\n\nView contents
'
- for snippet in tag_dict[category]:
+ for snippet in sorted(tag_dict[category]):
toAppend += f'{snippet} \n'
toAppend += '
\n\n'
toAppend += '
\n\n'
for category in tag_dict:
toAppend = toAppend + '## ' + EMOJIS[category] + ' ' + title_case(category) +'\n\n'
- for snippet in tag_dict[category]:
+ for snippet in sorted(tag_dict[category]):
someFile = open("snippets/" + snippet + '.md')
fileData = someFile.read()
codeParts = re.split(codeRe,fileData)