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?
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:
|Line Number||carryOn||totalHours||numberOfStudents||carryOn ==”y”||hours||average||OUTPUT|
Use the above flowchart to complete the Python code for this program: