gen4i4

Untitled

Mar 14th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. fruit = input()
  2. day_of_the_week = input()
  3. quantity = float(input())
  4.  
  5. day_of_the_week_is_valid = True
  6. fruit_is_valid = True
  7. price = 0
  8.  
  9. if day_of_the_week == 'Monday'\
  10. or day_of_the_week == 'Tuesday' \
  11. or day_of_the_week == 'Wednesday'\
  12. or day_of_the_week == 'Thursday'\
  13. or day_of_the_week == 'Friday':
  14. if fruit == 'banana':
  15. price = 2.50
  16. elif fruit == 'apple':
  17. price = 1.20
  18. elif fruit == 'orange':
  19. price = 0.85
  20. elif fruit == 'grapefruit':
  21. price = 1.45
  22. elif fruit == 'kiwi':
  23. price = 2.70
  24. elif fruit == 'pineapple':
  25. price = 5.50
  26. elif fruit == 'grapes':
  27. price = 3.85
  28. else:
  29. fruit_is_valid = False
  30.  
  31. elif day_of_the_week == 'Saturday' or day_of_the_week == 'Sunday':
  32. if fruit == 'banana':
  33. price = 2.70
  34. elif fruit == 'apple':
  35. price = 1.25
  36. elif fruit == 'orange':
  37. price = 0.90
  38. elif fruit == 'grapefruit':
  39. price = 1.60
  40. elif fruit == 'kiwi':
  41. price = 3.00
  42. elif fruit == 'pineapple':
  43. price = 5.60
  44. elif fruit == 'grapes':
  45. price = 4.20
  46. else:
  47. fruit_is_valid = False
  48.  
  49. else:
  50. day_of_the_week_is_valid = False
  51. if day_of_the_week_is_valid and fruit_is_valid:
  52. print(f'{price * quantity:.2f}')
  53. else:
  54. print('error')
  55.  
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment