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 now many times the maximum temperature occurred. For example, if the

image text in transcribed
image text in transcribed
image text in transcribed
Scenario An amateur meteorologist keeps a list of daily temperatures and wants a program now many times the maximum temperature occurred. For example, if the list of temperature [21, 24, 24, 23, 20, 19, 21, 24), the maximum of 24 occurs 3 times. (2 marks) om. ine inputs should be different from the example given in the D. Write three tests for this problem. The inputs should be different to scenario description above. At least one of your scription above. At least one of your tests must be a borderline case. Present the tests in a table, with a column for each in ble, with a column for each input and output, and an extra column with a brief explanation of why you selected each test, as is a "wry you selected each test, as is done for example in Block 2 Part 2 Activity 2.10. (3 marks) wecompose the problem into sub-problems. Use the > notation and state in brackets the type of the problem and of each sub-problem, following the example in Block 2 Part 2 Activity 2.44. (6 marks) d. This part of the question involves writing Python code. Name your Python file Q2_OUCU.py, where OUCU is your OU computer username, e.g. abc123. Write your code in this file and then submit the completed code file as part of the answer to this part of the question. Choose the patterns for the subproblem types you identified, instantiate the patterns into an algorithm, and translate the algorithm into code. Often lists are not generated from scratch but from an existing list. One common way is to "filter' 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. if the input_value satisfies the condition: 4ai append the input_value to the output_list print the output_list Note that co v er on how the list is initial Scenario An amateur meteorologist keeps a list of daily temperatures and wants a program now many times the maximum temperature occurred. For example, if the list of temperature [21, 24, 24, 23, 20, 19, 21, 24), the maximum of 24 occurs 3 times. (2 marks) om. ine inputs should be different from the example given in the D. Write three tests for this problem. The inputs should be different to scenario description above. At least one of your scription above. At least one of your tests must be a borderline case. Present the tests in a table, with a column for each in ble, with a column for each input and output, and an extra column with a brief explanation of why you selected each test, as is a "wry you selected each test, as is done for example in Block 2 Part 2 Activity 2.10. (3 marks) wecompose the problem into sub-problems. Use the > notation and state in brackets the type of the problem and of each sub-problem, following the example in Block 2 Part 2 Activity 2.44. (6 marks) d. This part of the question involves writing Python code. Name your Python file Q2_OUCU.py, where OUCU is your OU computer username, e.g. abc123. Write your code in this file and then submit the completed code file as part of the answer to this part of the question. Choose the patterns for the subproblem types you identified, instantiate the patterns into an algorithm, and translate the algorithm into code. Often lists are not generated from scratch but from an existing list. One common way is to "filter' 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. if the input_value satisfies the condition: 4ai append the input_value to the output_list print the output_list Note that co v er on how the list is initial

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

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago