Skip to content

Input Text Missing #4015

Closed
Closed
@joesinghh

Description

@joesinghh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions