Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-1
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
4c516d5c
authored
Oct 29, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c757a623
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
19 deletions
diy1.py
lesson.py
lesson3.py
quiz.py
diy1.py
View file @
4c516d5c
# 这是悟空为花果山小猴做臂力测试的程序代码
import
random
name
=
input
(
'你叫啥名啊?'
)
key
=
"abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了!"
power
=
int
(
input
(
'你臂力多少啊?'
))
message
=
"诺依,周末一起去看动漫展吧!"
list_hero
=
[
'猴三'
,
10
,
'猴一'
,
21
,
'猴五'
,
22
,
'猴队长'
,
29
,
'猴七'
,
30
]
key_message
=
""
for
i
in
range
(
len
(
list_hero
)):
for
i
in
message
:
if
i
%
2
==
1
and
list_hero
[
i
]
>=
power
:
str1
=
i
list_hero
.
insert
(
i
-
1
,
name
)
str2
=
random
.
choice
(
key
)
list_hero
.
insert
(
i
,
power
)
str3
=
random
.
choice
(
key
)
break
text
=
str1
+
str2
+
str3
print
(
list_hero
)
key_message
=
key_message
+
text
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
list_message
=
list
(
key_message
)
dict_hero
=
list_message
.
insert
(
5
,
noise
)
print
(
dict_hero
)
result_message
=
"/"
.
join
(
list_message
)
print
(
result_message
)
\ No newline at end of file
lesson.py
0 → 100644
View file @
4c516d5c
name
=
input
()
power
=
input
(
int
())
hero
=
[
'伊惹'
,
22
,
'小石头'
,
33
,
'宋余杭'
,
44
,
'裴锦红'
,
55
,
'领爷'
,
66
,
'段程'
,
88
]
input
(
"name"
)
input
(
"bl"
)
for
i
in
range
(
len
(
hero
)):
if
i
%
2
==
1
and
hero
[
i
]
>=
power
:
hero
.
insert
(
i
-
1
,
name
)
hero
.
insert
(
i
,
power
)
break
print
(
hero
)
lesson3.py
0 → 100644
View file @
4c516d5c
weather1
=
{
'上海'
:
15
,
'广州'
:
20
,
'深圳'
:
40
}
weather2
=
{
'上海'
:
17
,
'广州'
:
29
,
'深圳'
:
23
}
weather3
=
{
'上海'
:
10
,
'广州'
:
56
,
'深圳'
:
100
}
weather
=
{
'梦泪'
:
weather1
,
'国服'
:
weather2
,
'名刀'
:
weather3
}
while
True
quiz.py
View file @
4c516d5c
# 直接运行以下代码,说说你的发现:
i
=
99999999999999999999
list_hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
for
i
in
range
(
9999999
):
dict_hero
=
{
'赵一'
:
30
,
'丁二'
:
37
,
'孙五'
:
52
,
'王猛'
:
89
,
'周亮'
:
98
}
i
=
i
*
2
print
(
len
(
list_hero
))
print
(
i
)
print
(
len
(
dict_hero
))
\ No newline at end of file
\ 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