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
b189f242
authored
Dec 05, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5626717f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
diy1.py
hidihgfihgir/dftjft
quiz.py
diy1.py
View file @
b189f242
...
...
@@ -11,3 +11,5 @@ print(list_hero)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero
=
{
'猴三'
:
10
,
'猴一'
:
21
,
'猴五'
:
22
,
'猴队长'
:
29
,
'猴七'
:
30
}
print
(
dict_hero
)
print
dict_hero
[
'赵一'
]
dict_hero
[
'丁二'
]
=
47
\ No newline at end of file
hidihgfihgir/dftjft
0 → 100644
View file @
b189f242
dict={'可乐':3,'牛奶':4,'水':1,'辣条':3,'烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
k=input("你需要买什么")
if k dict:
print("叮咚,您的'+k+'需支付'+str(dict[k])+'元')
\ No newline at end of file
quiz.py
View file @
b189f242
dict
=
{
'牛奶'
:
4
,
'水'
:
1
,
'辣条'
:
3
,
'烤肉'
:
2
,
'果冻'
:
4
,
'乐事'
:
5
,
'奥利奥'
:
10
,
'巧克力'
:
6
}
k
=
input
(
'请输入你的姓名:'
)
v
=
input
(
'请输入你的最新成绩:'
)
if
k
in
dict
:
if
int
(
v
)
>
dict
[
k
]:
dict
[
k
]
=
int
(
v
)
print
(
k
+
'同学,恭喜你~成绩已更新为'
+
v
+
'分!'
)
else
:
print
(
k
+
'同学,遗憾的通知你,成绩为被刷新。'
)
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