First Script – Decision Making Write a script that can determine where different plants can be planted. Each plant has a name, a type (Flower, Vegetable, Tree, etc.), and a maximum height. There are three gardens as follows: 1. The Vegetable Garden can have only Vegetables, and there is no maximum height. 2. The Low Garden can have only Flowers, and there is a maximum height of 3. 3. The High Garden can have only Flowers, and there is a maximum height of 6. Print ONE line that identifies the one or more gardens that a given plant can be planted in. If a plant does not match the criteria for any of the gardens, then say so. Test the script six times with the following test data: 1. Name: Lily, Type: Flower, Height 3 2. Name: Bonsai, Type: Tree, Height 2| 3. Name: Carrots, Type: Vegetable, Height 1 4. Name: Corn, Type: Vegetable, Height 8 5. Name: Rose, Type: Flower, Height 5 6. Name: Sunflower, Type: Flower, Height 8 Example output: Please enter the plant name: Lily Please enter the plant type: Flower Please enter the plant height: 3 A Lily can be planted in the Low Garden or the High Garden. and so on...
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
1. pyth code please
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images