Scenario Amateur Meteorologist Keeps List Daily Temperatures Wants Program Calculate Many Q43853400

Scenario An amateur meteorologist keeps a list of daily temperatures and wants a program calculate how many times the maximum temperature occurred. For example, if the of temperatures is [21, 24, 24, 23, 20, 19, 21, 24], the maximum of 24 occurs 3 time a. Consider the problem of calculating how many times the maximum temperature occurs. i. What are the admissible inputs of the problem? ii. What is the output of this problem? (2 marks) b. Write three tests for this problem. The inputs should be different from the example given in the scenario description above. At least one of your tests must be a borderlim case. Present the tests in a table, with a column for each input and output, and an extra column with a brief explanation of why you selected each test, as is done for example in Block 2 Part 2 Activity 2.10. Often lists are not generated from scratch but from an existing list. One common way is to Yilter’ the existing list: generate a new list that only includes those values of the input list that satisfy some condition. Problem 2.1 Hot days Given a list of daily temperatures in degrees Celsius in a certain place, construct a list of the temperatures above 30. Assume temperatures are given as whole numbers. The pattern for the general problem is as follows. Pattern 2.3 List filtering initialise the input_list with the given values initialise other inputs of the problem initialise the output_list to the empty list for each input_value of the input_list: 4a if the input_value satisfies the condition: 4ai append the input_value to the output_list print the output_list Note that sten1 leaes open bo the listic initialiced tcouldbave bean aenarated as in 2. Show transcribed image text Scenario An amateur meteorologist keeps a list of daily temperatures and wants a program calculate how many times the maximum temperature occurred. For example, if the of temperatures is [21, 24, 24, 23, 20, 19, 21, 24], the maximum of 24 occurs 3 time a. Consider the problem of calculating how many times the maximum temperature occurs. i. What are the admissible inputs of the problem? ii. What is the output of this problem? (2 marks) b. Write three tests for this problem. The inputs should be different from the example given in the scenario description above. At least one of your tests must be a borderlim case. Present the tests in a table, with a column for each input and output, and an extra column with a brief explanation of why you selected each test, as is done for example in Block 2 Part 2 Activity 2.10.
Often lists are not generated from scratch but from an existing list. One common way is to Yilter’ the existing list: generate a new list that only includes those values of the input list that satisfy some condition. Problem 2.1 Hot days Given a list of daily temperatures in degrees Celsius in a certain place, construct a list of the temperatures above 30. Assume temperatures are given as whole numbers. The pattern for the general problem is as follows. Pattern 2.3 List filtering initialise the input_list with the given values initialise other inputs of the problem initialise the output_list to the empty list for each input_value of the input_list: 4a if the input_value satisfies the condition: 4ai append the input_value to the output_list print the output_list Note that sten1 leaes open bo the listic initialiced tcouldbave bean aenarated as in 2.
Expert Answer
Answer to Scenario An amateur meteorologist keeps a list of daily temperatures and wants a program calculate how many times the ma…
OR