**Purpose:** To practice recursion on a problem that can be split into parts.
**Degree of Difficulty:** Moderate
Aspiring Pokémon trainer Ash Ketchum has caught a lot of Pokémon. To keep them healthy, he regularly feeds them vitamins. However, the vitamins are bigger than what a Pokémon can swallow in one bite, and so when Ash's Pokémon team is given a vitamin, they will break it apart into smaller pieces. Sometimes, though, the vitamin is so big that the Pokémon have to break it apart more than once!
**Process:**
- If the vitamin's weight is less than or equal to 0.1 grams, it is small enough to eat and doesn't need to be broken. Thus, there is 1 edible piece for 1 Pokémon.
- Otherwise, the Pokémon will team up to smash the vitamin into pieces of equal weight. The number of new pieces seems to be random (the Pokémon can be a bit excitable), either 2, 3, or 4, but the weight of each new piece is the same (one-half, one-third, or one-quarter of the previous piece). The Pokémon will then break each of these pieces again until they are small enough to swallow.
**Example:**
Suppose the initial vitamin weighed 0.6 grams. The Pokémon break it once, and we randomly determine that the vitamin breaks into 2 parts (each part weighs 0.3 grams).
- The Pokémon break the first 0.3-gram piece, which breaks into 3 pieces. Since these pieces each weigh 0.1 grams, they are now edible, so we have 3 edible pieces so far.
- The Pokémon will then break the second 0.3-gram piece; this time, it breaks into 2 parts, each of which weighs 0.15 grams, which are still too large to eat.
- The Pokémon break each of these parts again; the first breaks into 3 parts, each weighing 0.05 grams, so we have 3 more pieces. The second breaks into 4 parts, each weighing 0.0375 grams, so that's another 4 pieces.
There are no longer any pieces larger than 0.1 grams, so the total number of edible pieces is 3 + 3 + 4 = 10 pieces. So in this case, 10 different Pokémon are able to get their vitamin dosage from a single, original 0.6-gram vitamin.
**Task:**
For this question, your task is to write a recursive program that will calculate how many edible vitamin pieces are made whenever a Pokémon team is given a vitamin that weighs W grams.
**Program Design:**
(a) Write a recursive function that simulates the breaking of a single vitamin. The weight of the vitamin (as a float) should be a parameter to your function. The function should return an integer, indicating the number of edible pieces produced from breaking the vitamin. To write this function, you will need to use random numbers for when the vitamin is broken into parts. If you first import random as rand, then the expression `rand.randint(a, b)` will give you a random number in the range from a to b (including a and b). For this question, you ARE allowed to use a loop in your recursive function if you like; however, recursion should still do the "real work". For instance, you might want to use a loop to iterate over the number of vitamin pieces created from a single smash.
(b) In the 'main' part of your program, write a few lines of code that asks the user for the size of a vitamin and uses a loop that will call your piece-counting recursive function 1000 times. Use the results of those 1000 simulations to report the average number of edible pieces produced from a vitamin. An example of your program running might look like this:
```
How big is the vitamin, in grams? 1.0
On average, a Pokémon team can get 18.774 bite-sized pieces from a 1 gram vitamin!
```
Note that because of the randomness involved, you might never get this exact result with an input of 1.0 grams, but it should be pretty close. Run your program using vitamins of weight 5, 10, and 100 grams. Copy/paste your output for all of the examples above into a document called `a8q3_output.txt` for submission.