Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-3
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
1cf39fea
authored
Sep 12, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
86d4a66f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
diy1.py
yyy
diy1.py
View file @
1cf39fea
...
...
@@ -9,5 +9,9 @@
#break
#print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero
=
{
'猴三'
:
10
,
'猴一'
:
21
,
'猴五'
:
22
,
'猴队长'
:
29
,
'猴七'
:
30
}
print
(
dict_hero
)
dict
=
{
'可乐'
:
3
,
'牛奶'
:
4
,
'水'
:
2
,
'辣条'
:
1
,
'果冻'
:
4
,
'巧克力'
:
5
,
'烤肉'
:
2
}
k
=
input
(
'你要买什么?'
)
if
k
in
dict
:
print
(
'叮咚,您的'
+
k
+
'需支付'
+
str
(
dict
[
k
])
+
'元'
)
else
:
print
(
'没货'
)
yyy
0 → 100644
View file @
1cf39fea
dict={'可乐':3,'牛奶':4,'水':2,'辣条':1,'果冻':4,'巧克力':5'烤肉':2}
k=input('你要买什么?')
if k in dict:
print('叮咚,您的'+k+'需支付'+str(dict[k])+'元')
else:
print('没货')
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