Manually sort a list of 10 integers in python
问题 I'm fairly new to programming; I've only been studying Python for a few weeks. I've been given an exercise recently that asks me to generate a list of integers, and then manually sort the numbers from lowest to highest in a separate list. import random unordered = list(range(10)) ordered = [] lowest = 0 i = 0 random.shuffle(unordered) lowest = unordered[0] while i in unordered: if unordered[i] < lowest: lowest = unordered[i] i += 1 if i >= len(unordered): i = 0 ordered.append(lowest)