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
cbf1dab5
authored
Jul 29, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
2c480ffe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
diy1.py
quiz.py
diy1.py
View file @
cbf1dab5
...
@@ -16,3 +16,6 @@ print(len(dict_hero))
...
@@ -16,3 +16,6 @@ print(len(dict_hero))
print
(
dict_hero
[
'猴三'
])
print
(
dict_hero
[
'猴三'
])
dict_hero
[
'猴三'
]
=
1231
dict_hero
[
'猴三'
]
=
1231
print
(
dict_hero
[
'猴三'
])
print
(
dict_hero
[
'猴三'
])
dict_hero
[
'sassa'
]
=
132123
print
(
dict_hero
)
\ No newline at end of file
quiz.py
View file @
cbf1dab5
# 直接运行以下代码,说说你的发现:
# 直接运行以下代码,说说你的发现:
list_hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
dict
=
{
'牛奶'
:
3
,
'饼干'
:
3
,
'巧克力'
:
5
,
'水'
:
8
,
'茉莉花茶'
:
5
}
dict_hero
=
{
'赵一'
:
30
,
'丁二'
:
37
,
'孙五'
:
52
,
'王猛'
:
89
,
'周亮'
:
98
}
a
=
input
(
"您想要买些什么?"
)
print
(
len
(
list_hero
))
if
a
in
dict
:
print
(
len
(
dict_hero
))
print
(
'您购买的'
+
a
+
'需要'
+
str
(
dict
[
a
])
+
'元'
)
\ No newline at end of file
else
:
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