Commit 427de9d0 by BellCodeEditor

auto save

parent 52532039
Showing with 11 additions and 0 deletions
#使用sort()的方法排序(使用该方法原列表中的元素顺序发生变化)
#格式:列表名.sort(key=str,lower,rever=true)key=srt,lower表示在排序时不区分大小写,reverse=true表示降价排列,默认为排列,fisle为排序
#注意该方法在对字符串进行排序时,先对大小字母进行排序,再对小写字母排序
grade=[98,99,97,100,90,94,89,95,100]
print("原列表"grade)
grade.sort()
print("升序",grade)
grade.sort(revese=true)
print("降序"grade)
#使用sorted
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment