How to find the Kth smallest number in an unsorted list in Python

1 Answer

0 votes
def find_kth_smallest_number(lst, k):
    lst.sort()
    
    return lst[k - 1]

lst = [42, 90, 21, 30, 37, 81, 45]
k = 3

result = find_kth_smallest_number(lst, k)
print(result)



"""
run:

37

"""

 



answered 6 days ago by avibootz
...