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
71a650fc
authored
Oct 29, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
06917293
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
diy1.py
diy1.py
View file @
71a650fc
baihuo
=
{
'巧克力'
:
6
,
'可乐'
:
3
,
'薯片'
:
4
,
'农夫山泉'
:
1
}
chengji
=
{
'张三'
:
80
,
'李四'
:
43
,
'王五'
:
97
,
'老六'
:
76
}
k
=
input
(
"你
要买哪种商品
:"
)
k
=
input
(
"你
的名字是什么
:"
)
shu
=
int
(
input
(
"你要买多少个
:"
))
v
=
int
(
input
(
"你的成绩是多少
:"
))
if
k
in
baihuo
:
if
k
in
chengji
:
print
(
'你要买的'
+
k
+
'需要'
+
str
(
baihuo
[
k
]
*
shu
)
+
'元'
)
if
v
>
chengji
[
k
]:
print
(
'你的成绩被刷新了,目前成绩为'
+
str
(
v
)
+
'分'
)
else
:
print
(
'很遗憾,你的成绩没有被刷新'
)
else
:
else
:
print
(
"你要买的商品不在售货机里面"
)
chengji
[
k
]
=
v
\ No newline at end of file
print
(
'你的第一次成绩已经被添加,目前成绩为'
+
str
(
v
)
+
'分'
)
\ 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