3.11 Program: Painting a wall (Python 3) (1) Prompt the user to input a wall\'s
ID: 3914973 • Letter: 3
Question
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 gallonsExplanation / Answer
//program1
#prompt user to input wall's width in feet
paintColors = {
'red':35,
'blue':25,
'green':23
}
wallHeight=float(input('Enter wall height(feet)): '))
wallWidth=float(input('Enter wall width(feet)): '))
areaOfWall = wallHeight * wallWidth
print ("Wall area: ",areaOfWall," square feet")
--------------------------------------------------------------
//output1
Enter wall height(feet)): 12
Enter wall width(feet)): 15
Wall area: 180.0 square feet
---------------------------------------------------
//program2
#prompt user to input wall's width in feet
paintColors = {
'red':35,
'blue':25,
'green':23
}
wallHeight=float(input('Enter wall height(feet)): '))
wallWidth=float(input('Enter wall width(feet)): '))
areaOfWall = wallHeight * wallWidth
print ("Wall area: ",areaOfWall," square feet")
#for 350 sq feet 1 gallon required so , gallons needed for areaOfWall is areaOfWall/350
paintRequired = areaOfWall/350
print ("Paint required: ",paintRequired," gallons")
------------------------------
//output2
Enter wall height(feet)): 12
Enter wall width(feet)): 15
Wall area: 180.0 square feet
Paint required: 0.5142857142857142 gallons
----------------------------------------------------------
//program3
#prompt user to input wall's width in feet
paintColors = {
'red':35,
'blue':25,
'green':23
}
wallHeight=float(input('Enter wall height(feet)): '))
wallWidth=float(input('Enter wall width(feet)): '))
areaOfWall = wallHeight * wallWidth
print ("Wall area: ",areaOfWall," square feet")
#for 350 sq feet 1 gallon required so , gallons needed for areaOfWall is areaOfWall/350
paintRequired = areaOfWall/350
print ("Paint required: ",paintRequired," gallons")
cansNeeded =round(paintRequired )
print ("Cans needed: ",cansNeeded," can(s)")
------------------------------------------------------
//output3
Enter wall height(feet)): 12
Enter wall width(feet)): 15
Wall area: 180.0 square feet
Paint required: 0.5142857142857142 gallons
Cans needed: 1 can(s)
---------------------------------------------------
//program4
#prompt user to input wall's width in feet
paintColors = {
'red':35,
'blue':25,
'green':23
}
wallHeight=float(input('Enter wall height(feet)): '))
wallWidth=float(input('Enter wall width(feet)): '))
areaOfWall = wallHeight * wallWidth
print ("Wall area: ",areaOfWall," square feet")
#for 350 sq feet 1 gallon required so , gallons needed for areaOfWall is areaOfWall/350
paintRequired = areaOfWall/350
print ("Paint required: ",paintRequired," gallons")
cansNeeded =round(paintRequired )
print ("Cans needed: ",cansNeeded," can(s)")
color=input('Choose a color to paint the wall: ')
cost =paintColors[color] * cansNeeded
print("Cost of purchasing ",color, " paint: $", cost)
------------------------------------------------------
//output4
Enter wall height(feet)): 12
Enter wall width(feet)): 15
Wall area: 180.0 square feet
Paint required: 0.5142857142857142 gallons
Cans needed: 1 can(s)
Choose a color to paint the wall: red
Cost of purchasing red paint: $ 35
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.