-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Added doctests to OddEvenTraposition #2152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added doctests to OddEvenTraposition #2152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if arr[i + 1] < arr[i]:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
can be replaced by:
if arr[i + 1] < arr[i]: arr[i], arr[i + 1] = arr[i + 1], arr[i]
|
||
>>> OddEvenTransposition([-.1, 1.1, .1, -2.9]) | ||
[-2.9, -0.1, 0.1, 1.1] | ||
""" | ||
for i in range(0, len(arr)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i in range(0, len(arr)): | |
for i in range(len(arr)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is mainly for doctests. Refactoring will be in other as @cclauss suggested before.
Please change main() to use Perhaps replace the first four lines of main() with: arr = list(range(10, 0, -1)) |
You already have my approval. |
So can I merge? |
Squash and merge |
* Added doctests * Change __main__ content
Describe your change:
Added missing doctests. Refactor will be in second PR
Checklist:
Fixes: #{$ISSUE_NO}
.