Commit 69f7f32
Update cocktail_shaker_sort.py (#10987)
* Update cocktail_shaker_sort.py
Added a docstring with clear explanations of the function and its parameters.
Changed variable names i, start, and end for better readability.
Improved comments to describe the purpose of each section of the algorithm.
Adjusted the loop ranges to make the code more concise and readable.
Removed redundant comments and variable assignments.
Provided a clear message when printing the sorted list.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update cocktail_shaker_sort.py
* typing: ignore[operator]
* Update cocktail_shaker_sort.py
* Update cocktail_shaker_sort.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>1 parent 29b8ccd commit 69f7f32
1 file changed
+37
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | | - | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | 16 | | |
9 | | - | |
10 | 17 | | |
11 | 18 | | |
12 | | - | |
13 | 19 | | |
14 | 20 | | |
15 | | - | |
16 | 21 | | |
17 | 22 | | |
18 | | - | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
23 | 35 | | |
24 | 36 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | 42 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
33 | 52 | | |
34 | 53 | | |
35 | 54 | | |
36 | 55 | | |
37 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
38 | 60 | | |
39 | 61 | | |
40 | 62 | | |
| |||
0 commit comments