I am writing a code to take user input and sort it in descending order. This is my code so far.
array = []
array=input().split()
for i in range(len(array)):
max_index = i
for j in range(i+1, len(array)):
if int(array[j]) > int(array[max_index]):
max_index = j
array[i],array[max_index] = array[max_index],array[i]
print(array)
The input is
50 40 20 10 30
The output I get is
['50', '40', '20', '10', '30']
['50', '40', '20', '10', '30']
['50', '40', '30', '10', '20']
['50', '40', '30', '20', '10']
['50', '40', '30', '20', '10']
What I need is
[50, 40, 20, 10, 30]
[50, 40, 20, 10, 30]
[50, 40, 30, 10, 20]
[50, 40, 30, 20, 10]
[50, 40, 30, 20, 10]
How do I remove the apostrophes and include a new line on the end? I'm new to programming (Have only been learning for roughly 4 weeks.