Python インタープリターは、paintRequiredCeiling が未定義であると言います。コードにエラーは見つかりませんでした。目的は、プログラムがユーザーからの入力を受け取り、塗装作業に必要なコスト/時間を計算することです。
import math
def main():
# Prompts user for sq and paint price
totalArea = float(input("Total sq of space to be painted? "))
paintPrice = float(input("Please enter the price per gallon of paint. "))
perHour = 20
hoursPer115 = 8
calculate(totalArea, paintPrice, perHour, hoursPer115)
printFunction()
def calculate(totalArea, paintPrice, perHour, hoursPer115):
paintRequired = totalArea / 115
paintRequiredCeiling = math.ceil(paintRequired)
hoursRequired = paintRequired * 8
costOfPaint = paintPrice * paintRequiredCeiling
laborCharges = hoursRequired * perHour
totalCost = laborCharges + costOfPaint
def printFunction():
print("The numbers of gallons of paint required:", paintRequiredCeiling)
print("The hours of labor required:", format(hoursRequired, '.1f'))
print("The cost of the paint: $", format(costOfPaint, '.2f'), sep='')
print("Total labor charges: $", format(laborCharges, '.2f'), sep='')
print("Total cost of job: $", format(totalCost, '.2f'), sep='')
main()