def calculate_roof_cost(): # Input roof dimensions and features length = float(input("Enter roof length (feet): ")) width = float(input("Enter roof width (feet): ")) pitch = float(input("Enter roof pitch (inches per foot): ")) valleys = int(input("Number of valleys: ")) ridges = int(input("Number of ridges: ")) skylights = int(input("Number of skylights: ")) chimneys = int(input("Number of chimneys: ")) # Calculate roof squares squares = (length * width) / 100 # Calculate roof pitch adjustment pitch_factor = 1 + (pitch / 12 * 0.25) # Calculate area adjustments for features valleys_area = valleys * 50 # Example adjustment for valleys ridges_area = ridges * 30 # Example adjustment for ridges skylights_area = skylights * 20 # Example adjustment for skylights chimneys_area = chimneys * 10 # Example adjustment for chimneys # Calculate total area total_area = squares * pitch_factor + valleys_area + ridges_area + skylights_area + chimneys_area # Calculate cost based on area and other factors material_cost = total_area * 10 # Example material cost per square foot labor_cost = total_area * 5 # Example labor cost per square foot total_cost = material_cost + labor_cost # Display results print(f"Roof squares: {squares:.2f}") print(f"Total area: {total_area:.2f} square feet") print(f"Total material cost: ${material_cost:.2f}") print(f"Total labor cost: ${labor_cost:.2f}") print(f"Total cost: ${total_cost:.2f}") if __name__ == "__main__": calculate_roof_cost()

Calculators