我正在编写一个python脚本,它根据孵化器中托盘的数量来计算孵化器可以携带的鸡蛋的容量。每个托盘可携带88个鸡蛋,有三种类型的孵化器。小型、中型和大型。小尺寸和中尺寸的打印输出效果很好,但对于大尺寸的打印,它只打印出一个空白区域。我应该在哪里修复我的代码得到大尺寸打印出来呢
我试着只从一个大型培养箱应该携带的最小尺寸开始计算范围,但它仍然给我同样的问题。我尝试过用值切换中等大小的计算代码来计算较大的大小,但它仍然消失了
tray_number = 2
tray_cap = 88
'small range'
small_min_cap = 176
small_max_cap = 704
'medium range'
medium_min_cap = 880
medium_max_cap = 5000
'large range'
large_min_cap = 5704
large_max_cap = 10000
capacity_increase = tray_cap*2
capacity = 0
total_cap = capacity + capacity_increase
print('Incubator calculations :\n')
'Calculations of the small capacity range'
print('SMALL CAPACITY:')
while small_max_cap >= total_cap >= small_min_cap:
print('a small incubator with ' + str(tray_number) + ' trays has a total capacity of = ' + str(total_cap))
total_cap += capacity_increase
tray_number += 2
print('\n')
'Calculations of the medium capacity range increasing by 2 trays each'
print('MEDIUM CAPACITY:')
while medium_max_cap >= total_cap >= medium_min_cap:
print('a medium incubator with ' + str(tray_number) + ' trays has a total capacity of = ' + str(total_cap))
total_cap += capacity_increase
tray_number += 2
print('\n')
'Calculations of the large capacity range increasing by 2 trays each'
print('LARGE CAPACITY:')
while large_max_cap >= total_cap >= large_min_cap:
print('a large incubator with ' + str(tray_number) + ' trays has a total capacity of = ' + str(total_cap))
total_cap += capacity_increase
tray_number += 2
print('\n')
我希望在“大容量”标题之后,一个类似中小型容量范围的列表也会显示在大容量的列表中
我得到的结果是:
Incubator calculations :
SMALL CAPACITY:
a small incubator with 2 trays has a total capacity of = 176
a small incubator with 4 trays has a total capacity of = 352
a small incubator with 6 trays has a total capacity of = 528
a small incubator with 8 trays has a total capacity of = 704
MEDIUM CAPACITY:
a medium incubator with 10 trays has a total capacity of = 880
a medium incubator with 12 trays has a total capacity of = 1056
a medium incubator with 14 trays has a total capacity of = 1232
a medium incubator with 16 trays has a total capacity of = 1408
a medium incubator with 18 trays has a total capacity of = 1584
a medium incubator with 20 trays has a total capacity of = 1760
a medium incubator with 22 trays has a total capacity of = 1936
a medium incubator with 24 trays has a total capacity of = 2112
a medium incubator with 26 trays has a total capacity of = 2288
a medium incubator with 28 trays has a total capacity of = 2464
a medium incubator with 30 trays has a total capacity of = 2640
a medium incubator with 32 trays has a total capacity of = 2816
a medium incubator with 34 trays has a total capacity of = 2992
a medium incubator with 36 trays has a total capacity of = 3168
a medium incubator with 38 trays has a total capacity of = 3344
a medium incubator with 40 trays has a total capacity of = 3520
a medium incubator with 42 trays has a total capacity of = 3696
a medium incubator with 44 trays has a total capacity of = 3872
a medium incubator with 46 trays has a total capacity of = 4048
a medium incubator with 48 trays has a total capacity of = 4224
a medium incubator with 50 trays has a total capacity of = 4400
a medium incubator with 52 trays has a total capacity of = 4576
a medium incubator with 54 trays has a total capacity of = 4752
a medium incubator with 56 trays has a total capacity of = 4928
LARGE CAPACITY:
Process finished with exit code 0
目前没有回答
相关问题 更多 >
编程相关推荐