Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-5-2
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
427de9d0
authored
Sep 04, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
52532039
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
list.py
list.py
0 → 100644
View file @
427de9d0
#使用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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment