我收到以下错误消息全局名称错误消息
当我尝试运行以下程序时,我收到以下消息:Builtins.NameError:未定义全局名称'GALONS'
选择 | 换行 | 行号
- def main():
- square_feet = float(input("Enter the square feet of the wall that is to be painted: "))
- gallons = (square_feet/115)
- paint = float(input("Enter the cost of paint per gallons: "))
- labor = (gallons * 8 * 20)
- price_paint = (paint + gallons)
- hours = (square_feet/14.37)
- total_cost = (labor + price_paint)
- charges()
- def charges():
- print ("The number of gallons of paint is", gallons)
- print ("The number of hours of labor is",hours)
- print ("The cost of the paint is",price_paint)
- print ("The cost for labor will be",labor)
- print ("The total cost for the paint job is", total_cost)
- main()