Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-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
bd6c17fa
authored
Jul 04, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
a598e1bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
diy.py
diy.py
View file @
bd6c17fa
...
...
@@ -8,8 +8,20 @@ b=['袁术','夏侯惇','曹操','关羽']
# 方法一使用b.remove()方法
b
.
remove
(
'关羽'
)
# 方法二使用b.pop(3)
b
.
pop
(
3
)
# 方法三使用b.pop(-1)
b
.
pop
(
-
1
)
# 打印出列表b
print
(
b
)
\ No newline at end of file
print
(
b
)
a
=
[
'华雄'
]
# 创建列表a,华雄
# 将关羽填到a列表中
# 方法一用insert()方法
a
.
insert
(
1
,
'关羽'
)
# 方法二用append('关羽')方法
# 打印出列表a
print
(
a
)
a
=
[
'华雄'
]
c
=
[
'颜良'
,
'文丑'
]
# 用extend()方法将列表c内容填到列表a
a
.
extend
(
c
)
# 打印出列表a
print
(
a
)
\ 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