subject

LAB ACTIVITY 3.18.1: LAB*: Program: Painting a wall Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))< br />
(1) Prompt the user to input a wall's height and width. Calculate and output the wall's area (integer). (Submit for 2 points).

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

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

Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.51 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 square feet
Paint needed: 0.51 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 square feet
Paint needed: 0.51 gallons
Cans needed: 1 can(s)

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

The Language is in python.
Here is what I have so far:
import math

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

wall_height = float(input('Enter wall height (feet):\n'))
wall_width = float(input('Enter wall width (feet):\n'))
wall_area = float(wall_width * wall_height)
print('{:.2f}'.format('Wall area:', wall_area, 'square feet')

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:00, daniella0123
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
image
Computers and Technology, 23.06.2019 01:30, winstonbendariovvygn
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
image
Computers and Technology, 24.06.2019 16:00, miner12924owhu4d
5.a fishing rod is formed from a composite material of 0.5 kg of glass fibers embedded in a matrix of 0.5 kg of epoxy resin. the glass fibers are assumed to be long, continuous and unidirectional. to achieve a greater stiffness it is proposed to use a different composite that is comprised of long continuous carbon fibers that will be embedded in a matrix of 0.5 kg of epoxy resin. if the modulus of elasticity of the carbon fiber composite is 10% greater than the elastic modulus of the glass fiber composite, estimate the mass of carbon fibers that will be used to make the carbon fiber composite. assume the applied tensile stress is parallel to the direction of the long axis of the fibers. the epoxy resin, glass fiber, and carbon fiber have an elastic modulus of 5, 86, and 350 gpa respectively and a density of 1100, 2500, and 1800 respectively.
Answers: 3
image
Computers and Technology, 24.06.2019 16:00, nothingworksoutforme
Your is an example of personal information that you should keep private.
Answers: 1
You know the right answer?
LAB ACTIVITY 3.18.1: LAB*: Program: Painting a wall Output each floating-point value with two digit...

Questions in other subjects:

Konu
Mathematics, 19.05.2020 15:20
Konu
Mathematics, 19.05.2020 15:20