winddude commited on
Commit
f72f7a0
1 Parent(s): f5cce07

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -116,11 +116,11 @@ Maurice "The Rocket" Richard was a Canadian ice hockey player who played for the
116
  Write a python function to sort an array of strings in reverse alphabetical order.
117
  ### Response:
118
  Here's the Python code for sorting an array of strings in reverse alphabetical order using the built-in sorted() method:
119
- ```python
120
- def reverse_sort(arr):
121
  arr = list(sorted(arr, key=lambda x: -x)) # Sorting in reverse order
122
  return arr
123
- ```
124
  This function takes an input array as argument and returns it sorted in reverse alphabetical order. The `key` parameter is used to specify how elements should be compared when sorting them. In this case, we use `-x`, which reverses the string before comparing it with other elements. This ensures that the smallest element comes first in the output array. Finally, the returned value is converted back into a list using the `list()` constructor.
125
  ```
126
  - this is shit. I don't recommend using this for code.
 
116
  Write a python function to sort an array of strings in reverse alphabetical order.
117
  ### Response:
118
  Here's the Python code for sorting an array of strings in reverse alphabetical order using the built-in sorted() method:
119
+ ```python
120
+ def reverse_sort(arr):
121
  arr = list(sorted(arr, key=lambda x: -x)) # Sorting in reverse order
122
  return arr
123
+ ```
124
  This function takes an input array as argument and returns it sorted in reverse alphabetical order. The `key` parameter is used to specify how elements should be compared when sorting them. In this case, we use `-x`, which reverses the string before comparing it with other elements. This ensures that the smallest element comes first in the output array. Finally, the returned value is converted back into a list using the `list()` constructor.
125
  ```
126
  - this is shit. I don't recommend using this for code.