Challenge
No
From WikiMedia
A group of your goatty friends are going to New Orleans for Mardi Gras. They want to take some bling, but are not sure how much they need. Write a program to help out.
There are big goats and small goats. Here are bling recommendations.
- Sequins: 0.4 kilos for bigs, 0.15 for smalls.
- Glitter: 0.2 kilos for bigs, 0.1 for smalls.
- Bead strands: 1.2 kilos for bigs, 0.7 kilos for smalls.
- Neck clocks (like Flavor Flav wears): two for bigs, one for smalls.
Users input number of bigs and smalls, and your program recommends bling to take.
Sample I/O:
- Bling estimator
- ===== =========
- Big goats? 1
- Small goats? 1
- You should take:
- Sequins: 0.55 kilos
- Glitter: 0.3 kilos
- Bead strands: 1.9 kilos
- Clocks: 3
More:
- Bling estimator
- ===== =========
- Big goats? 33
- Sorry, please enter a number more than zero, and ten or less.
- Big goats? 3
- Small goats? some
- Sorry, you must enter a whole number.
- Small goats? 5
- You should take:
- Sequins: 1.95 kilos
- Glitter: 1.1 kilos
- Bead strands: 7.1 kilos
- Clocks: 11
For the inputs, keep asking until you get a valid number.
Write an input function with this docstring:
- '''
- Input a goat count.
- Parameters
- ----------
- prompt : string
- Question to ask.
- Returns
- -------
- value : int
- Count.
- '''
Write a computation function with this docstring:
- '''
- Compute the amount of bling a goat group will need.
- Parameters
- ----------
- bigs : int
- Number of big goats.
- smalls : int
- Number of small goats.
- Returns
- -------
- sequins : float
- Kilos of sequins.
- glitter : float
- Kilos of glitter.
- bead_strands : float
- Kilos of bead strands.
- clocks : int
- Number of neck clocks.
- '''
Upload a zip of your project folder. The usual coding standards apply.
If you were logged in as a student, you could submit a solution to this exercise.
Where referenced