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
27115919
authored
Jul 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d442f8b4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
diy1.py
diy1.py
View file @
27115919
...
...
@@ -11,13 +11,15 @@
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
# dict_shop={"马":30,"牛":20,"鸡":5,"鱼":10}
# print(dict_shop)
dict_robotshop
=
{
'老八的shit'
:
35
,
'巴西草肉'
:
30
,
'小鸟伏特加'
:
3000000000000
,
'毛主席茅台'
:
100000000000000000
}
print
(
dict_robotshop
)
dict_student
=
{}
while
True
:
shop
=
input
(
"欢迎光临,请问你需要什么?
"
)
if
shop
in
dict_robotshop
:
many
=
int
(
input
(
"How many do you want?"
))
money
=
many
*
dict_robotshop
[
shop
]
print
(
"您购买的"
+
str
(
many
)
+
"个"
+
shop
+
"一共需要"
+
str
(
money
)
+
"元~"
)
name
=
input
(
"输入学生姓名:
"
)
number
=
float
(
input
(
"输入学生成绩:"
))
if
name
not
in
dict_student
:
dict_student
[
name
]
=
number
print
(
dict_student
)
else
:
print
(
"抱歉,暂时缺货哦,亲~"
)
if
number
>
dict_student
[
name
]:
dict_student
[
name
]
=
number
print
(
dict_student
)
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