python 报价程序_写一个Python程序,比较价格的

Thelarge“economy”sizeofapizzaisnotalwaysabetterbuythanthesmallersize.Pizzasizesaregivenasthediameterofthepizzaininches.However,thequantityofpizzaisdeterminedbytheareaof...

The large “economy” size of a pizza is not always a better

buy than the smaller size. Pizza sizes are given as the diameter of the pizza in inches.

However, the quantity of pizza is determined by the area of the pizza. Most people cannot easily estimate the difference in area between a ten-inch pizza and a twelve-inch pizza, and thus, cannot easily determine which size is the best buy.

Write a program that compares two sizes of pizza to determine which pizza is the better buy. You should ask the user for the diameter in inches and the price for each of the two pizzas. The output of your program will give the cost per square inch of each pizza and will tell which the better buy is.

Your program should make use of one function called unit_price. This function should have two parameters, the diameter of the pizza and its price. It should return the price per square inch of a pizza.

You should break your program down into several parts and make sure each part is working before you continue to the next part. Here is a division of the program into parts:

1. Get the input data for both the small and large pizzas from the user.

2. Compute the price per square inch for the small pizza (using the unit_price function).

3. Compute the price per square inch for the large pizza (using the unit_price function).

4. Determine which pizza is a better buy.

5. Print out the results.

就是比较大PIZZA饼和小PIZZA饼哪个实惠.

raw_input 大小PIZZA饼的价格和尺寸,

然后价格除以尺寸.

最后显示性价比高的是大PIZZA还是小PIZZA.

caozhipan1981,谢谢你提醒,管理员把骗子贴删了...

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值