Repository: TheAlgorithms/Python

Issue:
Concatenate/consolidate all algorithms with different implementations
### Feature description

There are lots of algorithms with the same concept but different implementations/methods in different files. All these should be moved into one file


Discussion:
hello sir
Can I take this issue.

@CaedenPH Please assign this task to me.
@digital-dev-07 Read the [contributing guidelines](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md#contribution).
> If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. We do not assign issues in this repo so please do not ask for permission to work on an issue.
!assign
> !assign

Please read the contributing guidelines. We do **not** assign issues in this repository. Instead open a new pull request and add `Fixes: #8098` to the description.
Please assign this issue to me. I want to contribute.
i want to contribute, may someone guide me bit of the process in it
@Pranjal-231003 The issue here is that some algorithms have multiple implementations, and these implementations are often scattered across multiple files. Sometimes these files will have very different names or will be scattered across multiple directories. This is a problem because it makes it harder for users to compare implementations and harder for contributors to figure out whether an algorithm is in the repo or not. We want to put different implementations of the same algorithm into a single file so that it's all in one place.

For example, this repo used to have `factorial_recursive.py` and `factorial_iterative.py`. We combined them into a single file `factorial.py`, and this file contains both the recursive implementation and the iterative implementation. This is the work that we're asking contributors to do for this issue.

If you want to contribute to solving this issue, look around the codebase and find an algorithm that's implemented by multiple files. Choose one of those files to keep, and copy the code from the other files into this main file. You may need to rename the file or rename some functions when you do this. Once you're done with that and you've confirmed that everything still works, please open a PR and one of us maintainers will get around to reviewing it eventually.

Resolving patch:
diff --git a/strings/reverse_letters.py b/strings/reverse_letters.py
--- a/strings/reverse_letters.py
+++ b/strings/reverse_letters.py
@@ -1,19 +1,24 @@
-def reverse_letters(input_str: str) -> str:
+def reverse_letters(sentence: str, length: int = 0) -> str:
     """
-    Reverses letters in a given string without adjusting the position of the words
-    >>> reverse_letters('The cat in the hat')
-    'ehT tac ni eht tah'
-    >>> reverse_letters('The quick brown fox jumped over the lazy dog.')
-    'ehT kciuq nworb xof depmuj revo eht yzal .god'
-    >>> reverse_letters('Is this true?')
-    'sI siht ?eurt'
-    >>> reverse_letters("I   love       Python")
-    'I evol nohtyP'
+    Reverse all words that are longer than the given length of characters in a sentence.
+    If unspecified, length is taken as 0
+
+    >>> reverse_letters("Hey wollef sroirraw", 3)
+    'Hey fellow warriors'
+    >>> reverse_letters("nohtyP is nohtyP", 2)
+    'Python is Python'
+    >>> reverse_letters("1 12 123 1234 54321 654321", 0)
+    '1 21 321 4321 12345 123456'
+    >>> reverse_letters("racecar")
+    'racecar'
     """
-    return " ".join([word[::-1] for word in input_str.split()])
+    return " ".join(
+        "".join(word[::-1]) if len(word) > length else word for word in sentence.split()
+    )
 
 
 if __name__ == "__main__":
     import doctest
 
     doctest.testmod()
+    print(reverse_letters("Hey wollef sroirraw"))
diff --git a/strings/reverse_long_words.py b/strings/reverse_long_words.py
deleted file mode 100644
--- a/strings/reverse_long_words.py
+++ /dev/null
@@ -1,21 +0,0 @@
-def reverse_long_words(sentence: str) -> str:
-    """
-    Reverse all words that are longer than 4 characters in a sentence.
-
-    >>> reverse_long_words("Hey wollef sroirraw")
-    'Hey fellow warriors'
-    >>> reverse_long_words("nohtyP is nohtyP")
-    'Python is Python'
-    >>> reverse_long_words("1 12 123 1234 54321 654321")
-    '1 12 123 1234 12345 123456'
-    """
-    return " ".join(
-        "".join(word[::-1]) if len(word) > 4 else word for word in sentence.split()
-    )
-
-
-if __name__ == "__main__":
-    import doctest
-
-    doctest.testmod()
-    print(reverse_long_words("Hey wollef sroirraw"))


Test patch: