Add more doctest to intro_sort.py #9943
diff --git a/sorts/intro_sort.py b/sorts/intro_sort.py
index f0e3645adbb7..908d2886533a 100644
--- a/sorts/intro_sort.py
+++ b/sorts/intro_sort.py
@@ -1,5 +1,5 @@
 """
-Introspective Sort is hybrid sort (Quick Sort + Heap Sort + Insertion Sort)
+Introspective Sort is a hybrid sort (Quick Sort + Heap Sort + Insertion Sort)
 if the size of the list is under 16, use insertion sort
 https://en.wikipedia.org/wiki/Introsort
 """
@@ -9,7 +9,6 @@
 def insertion_sort(array: list, start: int = 0, end: int = 0) -> list:
     """
     >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
     >>> insertion_sort(array, 0, len(array))
     [1, 2, 4, 6, 7, 8, 8, 12, 14, 14, 22, 23, 27, 45, 56, 79]
     """
@@ -27,8 +26,7 @@ def insertion_sort(array: list, start: int = 0, end: int = 0) -> list:
 def heapify(array: list, index: int, heap_size: int) -> None:  # Max Heap
     """
     >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
-    >>> heapify(array, len(array) // 2 ,len(array))
+    >>> heapify(array, len(array) // 2, len(array))
     """
     largest = index
     left_index = 2 * index + 1  # Left Node
@@ -47,9 +45,7 @@ def heapify(array: list, index: int, heap_size: int) -> None:  # Max Heap
 
 def heap_sort(array: list) -> list:
     """
-    >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
-    >>> heap_sort(array)
+    >>> heap_sort([4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12])
     [1, 2, 4, 6, 7, 8, 8, 12, 14, 14, 22, 23, 27, 45, 56, 79]
     """
     n = len(array)
@@ -69,9 +65,14 @@ def median_of_3(
 ) -> int:
     """
     >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
-    >>> median_of_3(array, 0, 0 + ((len(array) - 0) // 2) + 1, len(array) - 1)
+    >>> median_of_3(array, 0, ((len(array) - 0) // 2) + 1, len(array) - 1)
     12
+    >>> array = [13, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
+    >>> median_of_3(array, 0, ((len(array) - 0) // 2) + 1, len(array) - 1)
+    13
+    >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 15, 14, 27, 79, 23, 45, 14, 16]
+    >>> median_of_3(array, 0, ((len(array) - 0) // 2) + 1, len(array) - 1)
+    14
     """
     if (array[first_index] > array[middle_index]) != (
         array[first_index] > array[last_index]
@@ -88,7 +89,6 @@ def median_of_3(
 def partition(array: list, low: int, high: int, pivot: int) -> int:
     """
     >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
     >>> partition(array, 0, len(array), 12)
     8
     """
@@ -115,22 +115,16 @@ def sort(array: list) -> list:
     Examples:
     >>> sort([4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12])
     [1, 2, 4, 6, 7, 8, 8, 12, 14, 14, 22, 23, 27, 45, 56, 79]
-
     >>> sort([-1, -5, -3, -13, -44])
     [-44, -13, -5, -3, -1]
-
     >>> sort([])
     []
-
     >>> sort([5])
     [5]
-
     >>> sort([-3, 0, -7, 6, 23, -34])
     [-34, -7, -3, 0, 6, 23]
-
     >>> sort([1.7, 1.0, 3.3, 2.1, 0.3 ])
     [0.3, 1.0, 1.7, 2.1, 3.3]
-
     >>> sort(['d', 'a', 'b', 'e', 'c'])
     ['a', 'b', 'c', 'd', 'e']
     """
@@ -146,9 +140,7 @@ def intro_sort(
 ) -> list:
     """
     >>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12]
-
     >>> max_depth = 2 * math.ceil(math.log2(len(array)))
-
     >>> intro_sort(array, 0, len(array), 16, max_depth)
     [1, 2, 4, 6, 7, 8, 8, 12, 14, 14, 22, 23, 27, 45, 56, 79]
     """
@@ -167,7 +159,6 @@ def intro_sort(
     import doctest
 
     doctest.testmod()
-
     user_input = input("Enter numbers separated by a comma : ").strip()
     unsorted = [float(item) for item in user_input.split(",")]
-    print(sort(unsorted))
+    print(f"{sort(unsorted) = }")

### Describe your change:



* [ ] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [x] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
* [ ] Documentation change?

### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- I have not plagiarized.
* [x] I know that pull requests will not be merged if they fail the automated tests.
* [x] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [x] All new Python files are placed inside an existing directory.
* [x] All filenames are in all lowercase characters with no spaces or dashes.
* [x] All functions and variable names follow Python naming conventions.
* [x] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [x] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [x] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
* [x] If this pull request resolves one or more open issues then the description above includes the issue number(s) with a [closing keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue): "Fixes #ISSUE-NUMBER".
