python计算油漆体积

img

img


表面积除以铺展速率再乘以涂层数就等于油漆的体积,输出格式为[cans of paint] cans are required.


import math

area = int(input('Enter the surface area'))
rate = int(input('Enter the surface rate'))
coats = int(input('Enter the surface coats'))
volume = int(input('Enter the surface volume'))

ret = (area/rate*coats)/volume
print(f'{math.ceil(ret)} cans are required.')

输入的第一个数除以第二个数,乘以第三个数,除以第四个数,向上取整。

import math
n1=float(input('Enter the surface area:'))
n2=float(input('Enter the paint spreading rate:'))
n3=float(input('Enter the number of coats:'))
n4=float(input('Enter the paint can volume:'))
print('%d cans are required.'% math.ceil(n1*n3/n2/n4))
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632
from math import ceil

surface_area = float(input("Enter the surface area:"))
spreading_rate = float(input("Enter the spreading rate:"))
number_coats = float(input("Enter the number of coats:"))
volume = float(input("Enter the paint can volume:"))

cans = ceil((surface_area / spreading_rate) * number_coats) / volume
print(f'{int(cans)} cans are required.')