Guest User

Untitled

a guest
Jan 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import math
  2.  
  3. # Dictionary of paint colors and cost per gallon
  4. paintColors = {
  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. wallHeight = float(input('Enter wall height (feet): n'))
  13. wallWidth = float(input('Enter wall width (feet): n'))
  14.  
  15. wallArea = float((wallHeight) * (wallWidth))
  16.  
  17. print('Wall area:', wallArea, 'square feet')
  18.  
  19. # FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall
  20.  
  21. paint_gallons = ((wallArea) / 350)
  22.  
  23. print('Paint needed:', paint_gallons, 'gallons')
  24.  
  25. # FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
  26.  
  27. paint_cans = math.ceil(paint_gallons)
  28.  
  29. print('Cans needed:', paint_cans, 'can(s)n')
  30.  
  31. # FIXME (4): Calculate and output the total cost of paint can needed depending on color
  32.  
  33. wallColor = input('Choose a color to paint the wall: n')
  34.  
  35. paint_colors = {
  36. 'red' : 35,
  37. 'blue' : 25,
  38. 'green' : 23
  39. }
  40.  
  41. if wallColor in 'red':
  42. paint_cost = (paint_colors['red'] * (paint_cans))
  43.  
  44. if wallColor in 'blue':
  45. paint_cost = (paint_colors['blue'] * (paint_cans))
  46.  
  47. if wallColor in 'green':
  48. paint_cost = (paint_colors['green'] * (paint_cans))
  49.  
  50. print('Cost of purchasing', wallColor, 'paint: $', paint_cost)
Add Comment
Please, Sign In to add comment