Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-2
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
5fa32a69
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
7a62adbf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
quiz.py
quiz.py
View file @
5fa32a69
# 直接运行以下代码,说说你的发现:
dict
=
{
"可乐"
:
3
,
"雪碧"
:
4
,
"薯片"
:
5
,
"薯条"
:
6
,
"果汁"
:
7
}
list_hero
=
[
'语文'
,
440
,
'数学'
,
370
,
'英语'
,
520
,
'历史'
,
890
,
'政治'
,
980
]
k
=
input
(
"你想买什么?"
)
dict_hero
=
{
'语文'
:
440
,
'数学'
:
370
,
'英语'
:
520
,
'历史'
:
890
,
'政治'
:
980
}
if
k
in
dict
:
print
(
len
(
list_hero
))
print
(
"你购买的商品是"
+
k
+
"你需要支付"
+
str
(
dict
[
k
]))
print
(
len
(
dict_hero
))
else
:
dict_hero
[
"语文"
]
=
200
print
(
"不好意思我们没有这个商品"
)
print
(
dict_hero
)
\ No newline at end of file
dict_hero
[
"化学"
]
=
760
if
"生物"
in
dict_hero
:
print
(
"生物"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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