鱼C论坛

 找回密码
 立即注册
查看: 2898|回复: 3

用python写一个简单计算数量的程序

[复制链接]
发表于 2023-1-17 04:58:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Assume burgers come in packages of 10, and burger buns come in packages of 8. Write a Python program that calculates the number of packages of burgers and the number of packages of burger buns needed for a cookout, with the minimum amount of leftovers. The program should ask the user for the number of people attending the cookout and the number of burgers each person will be given. The program should display the following details:
• The minimum number of packages of burgers required
• The minimum number of packages of burger buns required
• The number of burgers that will be left over
• The number of burger buns that will be left over

假设汉堡包是10个一包,汉堡胚是8个一包。编写一个Python程序,计算一次野餐所需的汉堡包的数量和汉堡胚的数量。需要多少包汉堡和多少个汉堡胚使得剩菜的数量最少。该程序应要求用户提供参加野餐的人数以及每个人将得到的汉堡包数量。该程序应显示以下细节。
- 所需的汉堡包的最少包数
- 所需汉堡胚的最少包装数量
- 将会剩下的汉堡的数量
- 将会剩余的汉堡包的数量
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2023-1-17 08:38:24 | 显示全部楼层
自己做
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-1-17 08:41:29 | 显示全部楼层
这个很简单,只要理清楚逻辑关系就很好做了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2023-1-17 11:40:45 | 显示全部楼层
Mta123456 发表于 2023-1-17 08:41
这个很简单,只要理清楚逻辑关系就很好做了

请问要怎么做呢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-9-24 21:21

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表