Commit 68867934 by BellCodeEditor

auto save

parent 3ce31792
Showing with 30 additions and 0 deletions
'''
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
#引入海龟库
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment