Hossam Abdelaziz - Y10_03_CT15_Homework
Hossam Abdelaziz - Y10_03_CT15_Homework
Hossam Abdelaziz - Y10_03_CT15_Homework
Procedures
Question 1
A program is needed to analyse weekly statistics, which are stored in a list. A subprogram
within it should display the minimum value, the maximum value, and the average of all values
in the list.
Load ‘Hwk_Act1_Student’ into your programming environment.
Amend the code to add lines to:
define a subprogram
use a ‘for in list’ loop
calculate the average
call the subprogram.
© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
1
TOPIC 1: COMPUTATIONAL THINKING
Procedures
Question 2
A program is needed to count the occurrences of a target item in different data structures.
Here are the data structures:
Extension:
So far, your subprogram works with string targets.
Check if your program works with integer targets by adding another call to the subprogram.
Use 0 as the target argument.
If you program doesn’t work, then fix the error.
© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
2
TOPIC 1: COMPUTATIONAL THINKING
Procedures
© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
3