Computers and Technology
Computers and Technology, 21.06.2021 20:50, ChHal1958

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
1 import math
2
3 # Dictionary of paint colors and cost per gallon
4 paint_colors = {
5 'red': 35,
6 'blue': 25,
7 'green': 23
8 }
9
10 # FIXME (1): Prompt user to input wall's width
11 # Calculate and output wall area
12 wall_height = int(input('Enter wall height (feet):\n'))
13 print('Wall area:')
14
15 # FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall
16
17 # FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
18
19 # FIXME (4): Calculate and output the total cost of paint can needed depending on color
20

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:10, joanasprinkman2262
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
image
Computers and Technology, 22.06.2019 22:00, mrnotsosmart744
Discuss the ways in which electronic information associated with payments is addressed in terms of security. include encryption, secure sockets layers, and secure electronic transactions in your discussion. are there any other ways that consumers and businesses can keep their payment information secure in an electronic commerce environment? do you feel that your information is safe when conducting electronic business? why or why not?
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, clevelandjaniya1
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, ayoismeisjjjjuan
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
Do you know the correct answer?
Output each floating-point value with two digits after the decimal point, which can be achieved as f...

Questions in other subjects:

Konu
Mathematics, 11.10.2020 03:01
Konu
Mathematics, 11.10.2020 03:01