Paint Job Estimator Python 2
Paint Job Estimator Python 2
")
do_calculation = True
while (do_calculation):
while (True):
try:
# Input amount of square feet of wall space
square_feet = float(input("How many square feet of wall space do
you need painted? "))
if (square_feet <= 0):
print ("Zero and negative numbers can not be accepted.")
continue
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
while(True):
try:
# Input cost per gallon
cost_per_gallon = float(input("Cost per gallon of paint? $"))
if (cost_per_gallon <= 0):
print ('Zero and negative numbers can not be acepted.')
continue
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
while(True):
try:
# Input number of gallons needed
gallons_needed = float(square_feet)/125.0
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
# Hours of labor expected
hours_of_labor = 8 * gallons_needed
# Cost of Labor expected
labor_costs = 42.5 * hours_of_labor
# Paint cost
paint_costs = float(cost_per_gallon) * gallons_needed
# Number of gallons of paint
print("The number of gallons of paint required is %f" % gallons_needed)
# How long labor lasts
print("The number of gallons of hours of labor required are %f" %
hours_of_labor)