← Back to all posts
##### "Painting a Wall" challenge

Hi guys & girls,
I'm new to programming and am really trying to learn. I just cannot figure this problem out despite tinkering with it for the past 5 days. It's driving me insane. Any help will be greatly appreciated.

Problem:
3.11 Program: Painting a wall (Python 3)
(1) Prompt the user to input a wall's height and width. Calculate and output the wall's area. (Submit for 2 points).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet

(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value in a variable. (Submit for 2 points, so 4 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons

(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (Submit for 2 points, so 6 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons
Cans needed: 1 can(s)

(4) Extend by prompting the user for a color they want to paint the walls. Calculate and output the total cost of the paint cans depending on which color is chosen. Hint: Use a dictionary to associate each paint color with its respective cost. Red paint costs \$35 per gallon can, blue paint costs \$25 per gallon can, and green paint costs \$23 per gallon can. (Submit for 2 points, so 8 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons
Cans needed: 1 can(s)

Choose a color to paint the wall: red
Cost of purchasing red paint: \$35

import math

paintColors = {
'red': 35,
'blue': 25,
'green': 23
}

# Calculate and output wall area

wallHeight = input('12')
wallWidth = input('15')
wallArea = input(wallHeight) * input(WallWidth)

Assume = input('350')

# FIXME (4): Calculate and output the total cost of paint can needed depending on color

hotnewtop
ash15khng (729)

Which part do you need help on?

Rayanami (0)

I wish I had your problem with painting a wall in Python. I am in need to paint my wall in house...

wandaruth (0)

@Rayanami I understand you, pal. I just relocated to another country and don't know any good place where to paint my wall. I have been working in America for 15 years, but when relocated to Singapore the language is quite hard for me. I heard that https://www.paintingservicesingapore.sg/ are quite expensive, so it is better to paint all the stuff by myself. I have an idea of buying the paint abroad and try to make a delievery. Have you ever had such problem?

crosstalker1234 (0)

Thanks for responding. I'm just unsure where to plug the input for each line that says "FIXME".