Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-5
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
1242fcd9
authored
May 30, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
12e285c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
py.持家小能手
持家小能手.py
py.持家小能手
0 → 100644
View file @
1242fcd9
price={"苹果":2,"香蕉":3,"西瓜":5,"樱桃":20,"葡萄":7,"芒果":6}
price={"苹果":2,"香蕉":3,"西瓜":5,"樱桃":20,"葡萄":7,"芒果":6}
k=input("请输入您想购买的水果")
b=input("请输入今日该水果的单价")
if b
\ No newline at end of file
持家小能手.py
0 → 100644
View file @
1242fcd9
price
=
{
"苹果"
:
2.2
,
"香蕉"
:
3.5
,
"西瓜"
:
5.0
,
"樱桃"
:
20.0
,
"葡萄"
:
7.8
,
"芒果"
:
6.4
}
price
=
{
"苹果"
:
2.2
,
"香蕉"
:
3.5
,
"西瓜"
:
5.0
,
"樱桃"
:
20.0
,
"葡萄"
:
7.8
,
"芒果"
:
6.4
}
k
=
input
(
"请输入您想购买的水果:"
)
b
=
input
(
"请输入今日该水果的单价:"
)
if
k
in
price
:
if
float
(
b
)
<
price
[
k
]:
print
(
"妈妈,水果降价了"
)
else
:
print
(
"妈妈,水果涨价了,我们不买"
)
else
:
price
[
k
]
=
float
(
b
)
print
(
"添加了水果"
+
str
(
k
)
+
",单价为"
+
str
(
b
)
+
"元"
)
print
(
price
)
\ 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