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
a4977224
authored
Jan 18, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
0c88e1e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
1.py
sumtest.py
1.py
0 → 100644
View file @
a4977224
dict
=
{
'可口可乐'
:
3
,
'旺仔牛奶'
:
4
,
'农夫山泉'
:
1
,
'辣条'
:
3
,
'巴西烤肉'
:
2
,
'果冻'
:
4
,
'乐事'
:
5
,
'奥利奥'
:
10
,
'巧克力'
:
6
,
'冰红茶'
:
5
,
'玩具车'
:
30
,
'口香糖'
:
1
}
s
=
input
(
"你要什么?"
)
if
s
in
dict
:
print
(
"你的东西来了"
+
s
+
"请付钱"
+
str
(
dict
[
s
])
+
"元"
)
else
:
print
(
"对不起,此物品暂时缺货."
)
\ No newline at end of file
sumtest.py
View file @
a4977224
...
@@ -14,12 +14,17 @@
...
@@ -14,12 +14,17 @@
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero
=
{
"猴三"
:
10
,
'猴一'
:
21
,
'猴五'
:
22
,
'猴队长'
:
29
,
'猴七'
:
30
}
dict_hero
=
{
"猴三"
:
10
,
'猴一'
:
21
,
'猴五'
:
22
,
'猴队长'
:
29
,
'猴七'
:
30
}
dict_hero
[
"猴队长"
]
=
100
dict_hero
[
"猴队长"
]
=
100
dict_hero
[
"猴夫人"
]
=
110
dict_hero
[
"猴夫人"
]
=
110
if
"猴夫人"
in
dict_hero
:
if
"猴夫人"
in
dict_hero
:
print
(
ict_hero
)
print
(
dict_hero
)
print
(
dict_hero
)
#
print(dict_hero)
# 直接运行以下代码,说说你的发现:测试代码长度
# 直接运行以下代码,说说你的发现:测试代码长度
...
...
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