# 1. 提示用户购买水果的种类
fruits = (input("您想购买的水果: "))

# 1. 提示用户输入苹果的价格
price = float(input("%s的单价: " % fruits))

# 2. 提示用户输入购买苹果的重量
weight = float(input("购买%s的重量: " % fruits))

# 3. 计算金额
money = price * weight

print("%s的单价: %.2f 元/斤,购买了 %.2f 斤,需要支付 %.2f 元" % (fruits, price, weight, money))
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄