Need Help ?

Home / Expert Answers / Other / questionanswercorrections-output-each-floating-point-value-with-two-digits-after-the-decimal-point-w

(Answered): QUESTIONANSWERCORRECTIONS Output each floating-point value with two digits after the decimal point, ...



QUESTIONOutput each floating-point value with two digits after the decimal point, which can be achieved as follows: print({:.2f}.fo(4) Extend by prompting the user for a color they want to paint the walls. Calculate and output the total cost of the paint c

ANSWER1 height = float(input(Enter wall height (feet): n)) 2 width = float(input(Enter wall width (feet): n) 3 4 area = heigh

CORRECTIONS3: Compare output 0/1 Traceback (most recent call last): File main.py, line 10, in <module> cans_needed = int(math.ceil(pai4: Compare output 0/1 Traceback (most recent call last): File main.py, line 10, in <module> cans_needed = int (math.ceil(pa5: Compare output 0/1 Traceback (most recent call last): File main.py, line 10, in <module> cans_needed = int (math.ceil(pa6: Compare output 0/1 Traceback (most recent call last): File main.py, line 10, in <module> cans_needed = int(math.ceil(pai

Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) (1) Prompt the user to input a wall's height and width. Calculate and output the walls 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 Of 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 o 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 1 height = float(input("Enter wall height (feet): n')) 2 width = float(input('Enter wall width (feet): n') 3 4 area = height *width 5 print('wall area: {} square feet.format(round(area))) 6 7 sqft_per_gallon = 350 8 paint_needed = area/ sqft_per_gallon 9 print("Paint needed: {:.2f} gallons'.format(paint_needed)) 10 cans_needed = int(math.ceil(paint_needed)) 11 print('Cans needed: () can(s)'.format(cans_needed)) 12 13 pain_cost_dict = {'red': 35, 'blue': 25, 'green': 23} 14 color = input("nChoose a color to paint the wall: n") 15 if color in pain_cost_dict: rate = pain_cost_dict.get(color) 17 cost = cans_needed * rate 18 print('cost of purchasing {} paint: ${}'.format(color, cost)) 16 3: Compare output 0/1 Traceback (most recent call last): File "main.py", line 10, in <module> cans_needed = int(math.ceil(paint_needed)) NameError: name 'math' is not defined Input 12 15 red Your output starts with Enter wall height (feet): Enter wall width (feet): Wall area: 180 square feet Paint needed: 0.51 gallons Expected output starts with Enter wall height (feet): Enter wall width (feet): Wall area: 180 square feet Paint needed: 0.51 gallons Cans needed: 1 can (3) 4: Compare output 0/1 Traceback (most recent call last): File "main.py", line 10, in <module> cans_needed = int (math.ceil(paint_needed)) NameError: name 'math' is not defined Input 20 50 blue Your output starts with Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Expected output starts with Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Cans needed: 3 can(3) 5: Compare output 0/1 Traceback (most recent call last): File "main.py", line 10, in <module> cans_needed = int (math.ceil(paint_needed)) NameError: name 'math' is not defined 12 Input 15 red Your output Enter wall height (feet): Enter wall width (feet): Wall area: 180 square feet Paint needed: 0.51 gallons Enter wall height (feet): Enter wall width (feet): Wall area: 180 square feet Paint needed: 0.51 gallons Cans needed: 1 can (3) Expected output L Choose a color to paint the wall: Cost of purchasing red paint: $352 6: Compare output 0/1 Traceback (most recent call last): File "main.py", line 10, in <module> cans_needed = int(math.ceil(paint_needed)) NameError: name 'math' is not defined Input 20 50 blue Your output Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Cans needed: 3 can (3) - Expected output Choose a color to paint the wall: Cost of purchasing blue paint: $75-


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer to Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f...
We have an Answer from Expert

Buy This Answer $4

Place Order