Question: , you are asked to write a Python program to accomplish the following tasks. Please help a student, Luke, with his science project. The project
, you are asked to write a Python program to accomplish the following tasks.
Please help a student, Luke, with his science project. The project is to keep track of the growth (in height) of several bean sprouts. Luke used four types of beans: soy, pinto, green, lima. However, Luke only has a ruler measuring in inches, while the scientific reporting requires centimeters. The way of converting inches into centimeters is: One inch is 2.54 centimeters roughly.
So, please write a Python program for Luke to use so that he can enter the height of the bean sprouts and print out the corresponding height in centimeters. In addition, based on the growth, the program can judge whether the sprout is in fast, medium, or slow growth period.
| Height in centimeter | Growth period |
| >=10 | fast |
| >=5 | medium |
| <5 | slow |
At the end of the program, print out a summary. The summary includes
- What is the average of the growth?
- What is the lowest value of growth among all the sprouts?
Additional things:
- If Luke enters an invalid number, please say so and move on to the next.
- Please remove possible leading and ending white spaces in user input.
- Create a user-defined function to decide growth period based on growth. The parameter is growth and the function returns fast, medium, or slow based on growth.
- Use comments in your program. Put your name in the comment at the top.
- Last printout should include your name. Something like The program is made by XXX will do.
Testing and screenshot:
You should test your program with a couple of different runs, such as good inputs, bad inputs, etc. to get screenshots. You can use the following data to check:
|
| soy | pinto | green | lima |
| Height (in) | 3 | 5 | 4 | 1 |
| Height (cm) | 7.62 | 12.7 | 10.16 | 2.54 |
| Growth period | medium | fast | fast | slow |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
