Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_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
68867934
authored
Oct 07, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
3ce31792
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
a.py
demo.py
yuan.py
a.py
0 → 100644
View file @
68867934
'''
1.程序开始运行后,需要用户输入购买的苹果重量(重量可以是小数)
2.根据用户输入的重量计算出总价并输出,输出的结果保留两位小数。
3.总价的计算方式:
① 如果购买的苹果重量在六斤以下,则按照每斤5 元计算总价。②如果购买的苹果重量在六斤(含六斤)到十斤(含十斤)之间,则在每斤5 元的基础上打八折。
④如果购买的苹果重量在十斤以上,则在每斤 5 元的基础上打七折。
4.可以重复输入。
'''
while
True
:
s
=
int
(
input
(
'请输入用户购买的苹果重量:'
))
if
s
<
6
:
print
(
s
*
5
)
elif
s
>=
6
and
s
<=
10
:
print
(
s
*
5
*
0.8
)
else
:
print
(
s
*
5
*
0.7
)
\ No newline at end of file
demo.py
0 → 100644
View file @
68867934
yuan.py
0 → 100644
View file @
68867934
#引入海龟库
import
turtle
#开始画圆,半径为40
turtle
.
circle
(
40
)
turtle
.
circle
(
-
40
)
#移动到x为80的位置
turtle
.
forward
(
80
)
#画另外两个圆
turtle
.
circle
(
40
)
turtle
.
circle
(
-
40
)
#显示画布
turtle
.
done
()
\ 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