Create an PDF or NOTEPAD file that states the purpose in your own words, specify
ID: 3597091 • Letter: C
Question
Create an PDF or NOTEPAD file that states the purpose in your own words, specify input that is needed, expected output, and the step by step process that will obtain the output from the input (the algorithm) for each or the problems below. Also specify test data that can be used to all the scenarios described for each problem. Carefully read the requirements of each. No actual Python code should be used, just pseudo-code.
Problem: Write a process (do not create a program) that will allow the user to enter the total rainfall for each the 12 months of the year and store in a list. Calculate the average monthly total, yearly total, the lowest monthly total, and the highest monthly total without using any of the built-in functions for lists.
Explanation / Answer
rainfalls = empty list
for i = 1 to 12:
prompt from user for ith month rainfall
add rainfall to rainfalls list
total = Total(rainfalls)
average = total/12
(low, high) = FindLowHighInArr(rainfalls)
print average, total, low, high
Total(arr):
sum = 0
for i = 1 to size of arr:
sum = sum + arr(i)
return sum
FindLowHighInArr(arr):
low = arr(1)
high = arr(1)
for i = 2 to size fo arr:
if arr(i) is less than low
low = arr(i)
if arr(i) is greater than high
high = arr(i)
return (low, high)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.