For her PSHE homework on the importance of sleep, Clarisse has decided to collect data from pupils of different year groups from her school. She will do so using a short survey.

The aim of the survey will be to find out, on average, how many hours of sleep students have per night and to compare these findings with the recommended number of hours for high school students.

According to the National Sleep Foundation, the recommended numbers of hours of sleep per night are as follows:

Age Group | Recommended Sleep |

School-aged Children 6-13 years | 9 to 11 hours |

Teenagers 14-17 years | 8 to 10 hours |

Young Adults 18-25 years | 7 to 9 hours |

Clarisse’s survey will only have one question: How many hours do you sleep each night?

To help her calculate the resulting average number of hours of sleep per night she would like you to write a Python program based on the following flowchart:

#### Algorithm Trace Table

To gain a better understanding of how this algorithm works you will need to **complete the following trace table** considering the following user inputs:

*8 , y , 10 , y , 12 , n*

Line Number | carryOn | totalHours | numberOfStudents | carryOn ==”y” | hours | average | OUTPUT | |
---|---|---|---|---|---|---|---|---|

1 | “y” | |||||||

2 | 0 | |||||||

3 | 0 | |||||||

4 | True | |||||||

5 | 8 | |||||||

6 | 8 | |||||||

7 | 1 | |||||||

8 | 8 | |||||||

9 | 8 | |||||||

10 | “y” | |||||||

4 | True | |||||||

5 | 10 | |||||||

6 | 18 | |||||||

… |

#### Python Code

Use the above flowchart to complete the Python code for this program: