From 92c437db4658d4d5f76668610d1a2d45dc151149 Mon Sep 17 00:00:00 2001 From: changsheng Date: Sun, 31 May 2026 23:05:02 +0800 Subject: [PATCH 1/3] Add type hints to pancake_sort function --- sorts/pancake_sort.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sorts/pancake_sort.py b/sorts/pancake_sort.py index e5d600738435..b6e350a118b3 100644 --- a/sorts/pancake_sort.py +++ b/sorts/pancake_sort.py @@ -8,8 +8,10 @@ python pancake_sort.py """ +from typing import List -def pancake_sort(arr): + +def pancake_sort(arr: List[int]) -> List[int]: """Sort Array with Pancake Sort. :param arr: Collection containing comparable items :return: Collection ordered in ascending order of items @@ -36,4 +38,4 @@ def pancake_sort(arr): if __name__ == "__main__": user_input = input("Enter numbers separated by a comma:\n").strip() unsorted = [int(item) for item in user_input.split(",")] - print(pancake_sort(unsorted)) + print(pancake_sort(unsorted)) From baad4f5666725dd1036c1e813030f6cabd6d4faf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 31 May 2026 15:05:41 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sorts/pancake_sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorts/pancake_sort.py b/sorts/pancake_sort.py index b6e350a118b3..855c15dae015 100644 --- a/sorts/pancake_sort.py +++ b/sorts/pancake_sort.py @@ -38,4 +38,4 @@ def pancake_sort(arr: List[int]) -> List[int]: if __name__ == "__main__": user_input = input("Enter numbers separated by a comma:\n").strip() unsorted = [int(item) for item in user_input.split(",")] - print(pancake_sort(unsorted)) + print(pancake_sort(unsorted)) From f876a9d643c20cc329448467abdf80e3862f0c54 Mon Sep 17 00:00:00 2001 From: changsheng Date: Mon, 1 Jun 2026 19:55:09 +0800 Subject: [PATCH 3/3] Use modern list[int] type hint instead of deprecated typing.List --- sorts/pancake_sort.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sorts/pancake_sort.py b/sorts/pancake_sort.py index 855c15dae015..035dd35520b2 100644 --- a/sorts/pancake_sort.py +++ b/sorts/pancake_sort.py @@ -8,10 +8,8 @@ python pancake_sort.py """ -from typing import List - -def pancake_sort(arr: List[int]) -> List[int]: +def pancake_sort(arr: list[int]) -> list[int]: """Sort Array with Pancake Sort. :param arr: Collection containing comparable items :return: Collection ordered in ascending order of items