Following program is used to sort a list
for i in range(len(q)):
for j in range(len(q)):
if not (q[i] < q[j]):
t = q[i]
q[i] = q[j]
q[j] = t
contents of q are : {-1 2 4}
The output I get has one empty number like:
4
-1 2
ie extra number (empty) between 4 and -1. What am I doing wrong?
您想对列表进行排序?
your_list.sort()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.