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
3285e0cb
authored
Jun 26, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
dad49a7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
diy1.py
diy1.py
View file @
3285e0cb
dict
=
{
'A'
:
3
,
'B'
:
4
,
'C'
:
1
}
cost
=
{
'A'
:
5.2
,
'B'
:
12.9
,
'C'
:
2.4
}
k
=
input
(
'买啥?'
)
k
=
input
(
'啥?'
)
if
k
in
dict
:
v
=
input
(
'钱?'
)
print
(
'你的'
+
k
+
'给'
+
str
(
dict
[
k
])
+
'元'
)
if
k
in
cost
:
if
float
(
v
)
<
cost
[
k
]:
cost
[
k
]
=
float
(
v
)
print
(
k
+
"降价"
+
v
)
else
:
print
(
k
+
"涨价"
)
else
:
else
:
print
(
'没了'
)
cost
[
k
]
=
float
(
v
)
\ No newline at end of file
print
(
k
+
v
)
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