Skip to content

Input Text Missing #4015

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

Closed
joesinghh opened this issue Dec 7, 2020 · 1 comment · Fixed by #4016
Closed

Input Text Missing #4015

joesinghh opened this issue Dec 7, 2020 · 1 comment · Fixed by #4016

Comments

@joesinghh
Copy link
Contributor

joesinghh commented Dec 7, 2020

unlike other python files bitonic_sort.py Doesn't have any proper input statement :

    a = []

    n = int(input().strip())
    for i in range(n):
        a.append(int(input().strip()))
    up = 1

    sort(a, n, up)
    print("\n\nSorted array is")
    for i in range(n):
        print("%d" % a[i])

It's quit Confusing because user who haven't seen the code won't know what is the first input.

It should be written as :

   user_input = input("Enter numbers separated by a comma:\n").strip()
    unsorted = [int(item) for item in user_input.split(",")]

    up = 1

    sort(unsorted,len(unsorted), up)
    print("\nSorted array is")
    print(*unsorted, sep=",")

This not only removes a loop but also makes to more understandable

@joesinghh
Copy link
Contributor Author

Shall i add another PR which will include Doctests in bitonic_sort.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant