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
04447d33
authored
Mar 20, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5d4d1144
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
19 deletions
1.py
2.py
diy1.py
quiz.py
1.py
View file @
04447d33
dict
=
{
'方便面'
:
5
,
'辣条'
:
2
,
'果冻'
:
19
,
'黄焖鸡米饭'
:
120
}
import
random
h
=
input
(
"你想要什么"
)
key
=
"abcdefgh使用编程实现位移替换加密,制作密码机关真是太好玩了哈哈!"
if
h
in
dict
:
message
=
input
(
"请输入"
)
print
(
'你想要的东西要'
+
str
(
dict
[
h
])
+
'元'
)
key_message
=
""
else
:
noise
=
"ghgfdgfdfdf"
print
(
'sorry,we not have'
)
for
i
in
message
:
\ No newline at end of file
str1
=
i
str2
=
random
.
choice
(
key
)
str3
=
random
.
choice
(
key
)
text
=
str1
+
str2
+
str3
key_message
=
key_message
+
text
list1
=
list
(
key_message
)
index
=
random
.
randint
(
0
,
len
(
key_message
))
list1
.
insert
(
index
,
noise
)
re
=
""
.
join
(
list1
)
print
(
re
)
\ No newline at end of file
2.py
0 → 100644
View file @
04447d33
dict_list
=
{
"继国缘一"
:
"无限"
,
"岩柱"
:
50
}
dict_list
[
"炭治郎"
]
=
"主角"
dict_list
[
"岩柱"
]
=
"悲鸣与行冥"
dict_list
[
"继国缘一"
]
print
(
dict_list
)
\ No newline at end of file
diy1.py
deleted
100644 → 0
View file @
5d4d1144
dict_hero
=
{
'猴子'
:
10
,
'猴一'
:
21
,
'猴二'
:
21
,
'猴五'
:
22
,
'猴队长'
:
29
,
'猴七'
:
30
,}
dict_hero
[
'猴七'
]
dict_hero
[
'猴七'
]
=
10
print
(
dict_hero
)
\ No newline at end of file
quiz.py
deleted
100644 → 0
View file @
5d4d1144
# 直接运行以下代码,说说你的发现:
list_hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
dict_hero
=
{
'赵一'
:
30
,
'丁二'
:
37
,
'孙五'
:
52
,
'王猛'
:
89
,
'周亮'
:
98
}
print
(
len
(
list_hero
))
print
(
len
(
dict_hero
))
\ 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