Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_6
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
4d0d4e8c
authored
Nov 22, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
87516d43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
diy3.py
xibuniuzai.py
diy3.py
View file @
4d0d4e8c
# 勇于挑战的创造师,请运行下面的代码,观察运行结果,和小伙伴们说说你的发现?
# 和你的小伙伴讲讲史上有名的三英战吕布的故事。然后完成下面挑战,并说说列表切片是什么,怎么用:
a
=
[
'华雄'
]
c
=
[
'颜良'
,
'文丑'
,
'许褚'
,
'夏侯惇'
,
'蒋干'
]
# 省略繁杂情节,刘关张三人一起冲入战场,围攻吕布:
a
=
[
'吕布'
]
b
=
[
'袁术'
,
'公孙瓒'
,
'关羽'
,
'张飞'
,
'刘备'
,
'曹操'
]
c
=
(
b
[
3
:
5
])
a
.
extend
(
c
)
a
.
extend
(
c
)
print
(
a
)
print
(
a
)
\ No newline at end of file
xibuniuzai.py
View file @
4d0d4e8c
...
@@ -2,8 +2,13 @@ from random import randint#导入随机randint()函数
...
@@ -2,8 +2,13 @@ from random import randint#导入随机randint()函数
from
time
import
sleep
#导入sleep()函数
from
time
import
sleep
#导入sleep()函数
#导入函数
#导入函数
子弹
=
0
子弹
a
=
0
while
True
:
while
True
:
if
装子弹
=
0
:
if
子弹
a
==
0
:
print
(
'电脑选择:装子弹'
)
a
=
randint
(
0
,
3
)
子弹
+=
1
if
a
==
1
or
a
==
2
:
\ No newline at end of file
电脑选择
=
装子弹
print
(
'电脑选择:装子弹'
)
子弹
a
+=
1
if
a
==
3
:
print
(
'防御'
)
\ 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