4 Respuestas
0
You can do this
sorted_list = sorted(old_list[1:])
This way will not include the 0 index element though, so you need to add back if required
0
thanks but i want a array not a list
0
It's the same, you can try it your own
0
Arrays start from 0. That's just a fundamental fact. If you want an indexed list that doesn't use array rules, you want to use a dictionary.
i = 1
fake_array = {}
for num in num_list = [1, 2, 3]:
fake_array[i] = num
i += 1
fake_array[1] == 1 #will be True