Merge branch 'master' into revert-22-patch-1
This commit is contained in:
@@ -9,6 +9,7 @@ python3 -m doctest -v bubble_sort.py
|
||||
For manual testing run:
|
||||
python bubble_sort.py
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
@@ -39,14 +40,11 @@ def bubble_sort(collection):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
# For python 2.x and 3.x compatibility: 3.x has not raw_input builtin
|
||||
# otherwise 2.x's input builtin function is too "smart"
|
||||
if sys.version_info.major < 3:
|
||||
input_function = raw_input
|
||||
else:
|
||||
input_function = input
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
user_input = input_function('Enter numbers separated by a comma:\n')
|
||||
user_input = raw_input('Enter numbers separated by a comma:\n').strip()
|
||||
unsorted = [int(item) for item in user_input.split(',')]
|
||||
print(bubble_sort(unsorted))
|
||||
|
||||
Reference in New Issue
Block a user