From the Text Book page 7 the following flow chart is taken.
We can Write a program to satisfy the above algorithm - In the example below I have used Sub Routines for each of the question areas below the first one. - This is a good way of splitting up your code and making it easy to understand. A Sub routine is a separate piece of code that can be "called" from another area of the code - one or more times. To write a sub routine just start it (outside of any other routine but inside the class) with the keyword def.
You already have one sub routine called main.
def main():
Sub Routines
This sub routine is called feathers() - it deals with the feathers question
Your sub routine should be after main(): but before the code that calls main for the first time.
When you have written the program think about how to test it - go back and look at the flowchart to help you see the code paths through the program that need to be tested.
If you are feeling adventurous then add another definition for errors - you can then call errors from an else: to capture times when the user has not put "Y" or "N" - You can give them an error message and restart with main()
- This program should have taught you to split your code into sub routines.
- Use multiple code branches each being handled by as sub routine.
- Using a secondary branch (i.e. gills after scales after warm or cold blooded