小编Rob*_*uez的帖子

Python中的乘法函数

我正在为我的班级写一个简短的程序而且我被困在最后一部分.当我运行程序时,一切都正常运行,直到我到达代码的末尾,我试图将两个单独函数的成本相乘以定义另一个函数.我怎么能纠正这个?

这是完整的代码:

def main():
    wall_space = float(input('Enter amount of wall space in square feet: '))
    gallon_price = float(input('Enter the cost of paint per gallon: '))
    rate_factor = wall_space / 115
    total_gallons(rate_factor, 1)
    total_labor_cost(rate_factor, 8)
    total_gal_cost(rate_factor, gallon_price)
    total_hourly_cost(rate_factor, 20)
    total_cost(total_hourly_cost, total_gal_cost)
    print()

def total_gallons(rate1, rate2):
    result = rate1 * rate2
    print('The number of gallons of required is: ', result)
    print()

def total_labor_cost(rate1, rate2):
    result = rate1 * rate2
    print('The hours of labor required are: ', result)
    print()

def total_gal_cost(rate1, rate2):
    result …
Run Code Online (Sandbox Code Playgroud)

python function definition multiplication

0
推荐指数
1
解决办法
4971
查看次数

标签 统计

definition ×1

function ×1

multiplication ×1

python ×1