diff --git a/Python/sorting/timsort.py b/Python/sorting/timsort.py new file mode 100644 index 0000000..882f7b9 --- /dev/null +++ b/Python/sorting/timsort.py @@ -0,0 +1,9 @@ +# Using the sort() method +a = [5, 3, 1, 4, 6, 2] +a.sort() +print("Sorted list using sort():", a) + +# Using the sorted() function +a = [5, 3, 1, 4, 6, 2] +sorted_list = sorted(a) +print("Sorted list using sorted():", sorted_list)