簡體   English   中英

為什么我的參數沒有傳遞給參數?

[英]Why aren't my arguments being passed to the parameters?

處理功能並成為主要功能的項目。

控制其余功能。

wall = 112
paint = 1
work = 8
premier = 20.50
generic = 10.75
labor_c = 12.75

print('Welcome to A&PM Painting Co. How may we help you today?''\n')
def paint_job():
    space = float(input('What is the measurement of the area' +\
                       ' you want painted? '))
    gallon(space)
    labor()
    paint_cost()
    labor_chrg()
    tot_cost()

調用所有功能

def gallon(space):
    global final
    final = space / wall
    print('\n''The gallons of paint required for the ' +\
          'job is', format(final, '.1f'),'gallons''\n')

def labor():
    global job
    job = final * work
    print('The hours of labor required for this' +\
          ' job is', format(job, '.1f'),'hours''\n')

def paint_cost():
    ask = input('Would you like to use premier or generic paint? ')
    if ask == "premier":
        prem_cost = final * premier
        print('The cost of the paint will total up ' +\
              'to be', format(prem_cost, '.2f'),'dollars''\n')
        labor_chrg(prem_cost)
    else:
        gene_cost = final * generic
        print('The cost of the paint will total up ' +\
              'to be', format(gene_cost, '.2f'),'dollars''\n')
        labor_chrg(gene_cost)

他/她是否想要高級或通用油漆。

def labor_chrg(arg):
    paint_c = arg
    job = final * work
    l_charge = job * labor_c
    print('The charge of the labor done will total up ' +\
          'to be', format(l_charge, '.2f'),'dollars''\n')
    tot_cost(paint_c, labor_c)

def tot_cost(paint_c, labor_c):
    paint_c1 = paint_c
    labor_c1 = labor_c
    p_cost = final * paint_c1
    l_charge = job * labor_c1
    total = p_cost + l_charge
    print('The total cost of the project you requested ' +\
          'will be', format(total, '.2f'),'dollars''\n')

完成總費用的計算。

paint_job()

我很難弄清楚為什么我的參數沒有正確傳遞給參數。 誰能告訴我怎么了?

您需要在以下功能中輸入一些內容:

labor_chrg()
tot_cost()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM