Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 4 : Flower Bunches This is a more challenging problem that will require you to take your time and design a solution. We have
Part : Flower Bunches
This is a more challenging problem that will require you to take your time and design a solution. We have a scenario where we have high value flowers, low value flowers, and greenery the decorative leaves and accessories. Given a budget, we want to spend our entire budget to create a bunch of flowers. Write a function makebunchhigh low, green, budget takes integer for number of high, low and greenery items, and a budget, and returns a list of the flowers used to make the bunch.
There are a number of rules
High value flowers which cost each, and a maximum of can be used, regardless of how many flowers are available.
Low value flowers cost each, and any number can be used
Greenery costs each, and a bunch needs a minimum of items of greenery, with no
maximum
The entire budget must be used.
If a bunch cannot be created within the rules and there is budget left over, then return an
empty list
If a bunch cannot be created due a a lack of flowers, return an empty list
outputs:
makebunch
Here, we input high values, low values, greenery, and a budget of The resulting output is high value flowers low values flowers, and greenery items
makebunch
Outputs large flowers low value flowers and pieces of greenery
makebunch
Here, there is not enough greenery to satisfy the minimum rules, and so an empty list is returned.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started