Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

weal Q )

Answered: 1 week ago