Question: Execute the code using the following test data then answer the questions: Test data: 10, 101,-1,5, 0 a) Describe what happened when you entered


Execute the code using the following test data then answer the questions: Test data: 10, 101,-1,5, 0 a) Describe what happened when you entered each value. b) What does the counter variable do? What does the accumulator variable do? Why do they have to be initialized to zero before we use them? c) What type of variable is good data and how is it being used in the program? Test data: 0 d) Describe what happened when the sentinel value was the first number input. e) How could we alter the code to prevent this from happening? #Constants MIN = 1 MAX = 100 SENTINEL = 0 def main(): count = 0 #counter variable total = 0 #accumulator variable int_value = get_integer() #priming read while int_value != SENTINEL: count += 1 total + int_value int value = get_integer() #loop read print(Total number of values entered is', count) print("The sum of the values entered is', total) print("The average value is', total/count) def get_integer0: num_input = int(input('Enter a value between 1 and 100, 0 to stop: ')) good_data = MIN
Step by Step Solution
3.40 Rating (159 Votes )
There are 3 Steps involved in it
Lets go through the code and test data step by step Test data 10 101 1 5 0 a Describe what happened when you entered each value 1 10 The code accepts ... View full answer
Get step-by-step solutions from verified subject matter experts
