This question is about Block 2 Part 2 Section 2.3.2 (Find the best value). Consider again a list of hourly temperature readings from a fridge, as described in Question 9. Write a program that prints the hour at which the temperature first reached its maximum value. Assume position 0 is the reading at midnight (which will be printed as 0 : 00), position 1 is the reading at 1am (1 : 00), etc. The list has at least 1 and at most 23 readings. To get you started, the answer box contains, as comments, Pattern 2.9 version 3 (Find position of first best value), taken from the solution to Activity 2.32. Before completing the current quiz question, revisit Activity 2.32. Write the corresponding code beneath each comment. Use variable names appropriate to the problem at hand instead of the generic names used by the pattern. The first step has been done for you. Note that the output is expected to have a space before and after the colon. Input Result [4.7] 0 : 00 [4.7, 3] 0 : 00 [4.7, 3, 4.8] 2 : 00
This question is about Block 2 Part 2 Section 2.3.2 (Find the best value).
Consider again a list of hourly temperature readings from a fridge, as described in Question 9. Write a program that prints the hour at which the temperature first reached its maximum value. Assume position 0 is the reading at midnight (which will be printed as 0 : 00), position 1 is the reading at 1am (1 : 00), etc. The list has at least 1 and at most 23 readings.
To get you started, the answer box contains, as comments, Pattern 2.9 version 3 (Find position of first best value), taken from the solution to Activity 2.32. Before completing the current quiz question, revisit Activity 2.32.
Write the corresponding code beneath each comment. Use variable names appropriate to the problem at hand instead of the generic names used by the pattern. The first step has been done for you. Note that the output is expected to have a space before and after the colon.
Input | Result |
---|---|
[4.7]
|
0 : 00
|
[4.7, 3]
|
0 : 00
|
[4.7, 3, 4.8]
|
2 : 00
|
Step by step
Solved in 4 steps with 2 images