Question: For this program, I want to implement lists. I just don't know where to add them. I need some help with that. PLEASE DON'T USE

For this program, I want to implement lists. I just don't know where to add them. I need some help with that. PLEASE DON'T USE GLOBAL VARIABLES, PASSES OR BREAKS

def main():

sum = 0 average = 0 min = 0 max = 0 num_odd = 0 num_even = 0 count = 0

print_intro() num = get_numbers() max = num min = num while num != 0: count += 1 sum += num # Min Max if num > max: max = num if num < min: min = num # Even Odd if num % 2 == 0: num_even += 1 else: num_odd += 1 num = get_numbers()

average = calc_average(sum, count) print_results(sum, average, num_even, num_odd, min, max, count)

def print_intro(): """ Print intro message :param: none :return: none """ print('Welcome to Statbot 1.1! ')

def get_numbers(): """ Get user input for an integer :param: none :return: num """ num = 0 num = int(input('Enter an integer, or 0 to quit: ')) return num

def calc_average(sum, count): """ Calculate average :param sum: total of entered numbers :param count: count of total numbers entered :return: average """ average = 0 if count > 0: average = sum / count return average

def print_results(sum, average, num_even, num_odd, min, max, count): """ Print results and closing message :param: none :return: none """ if count > 0: print(f' {"Statistic":<15}{"Value":>15}', f' {("-"*30)}' f' {"Sum":<15}{sum:>15}', f' {"Average":<15}{average:>15.2f}', f' {"Even numbers":<15}{num_even:>15}', f' {"Odd numbers":<15}{num_odd:>15}', f' {"Minimum":<15}{min:>15}', f' {"Maximum":<15}{max:>15}', f' {("-"*30)}' ' Thanks for using StatBot 1.1!!') else: print(' Thanks for using StatBot 1.1!!')

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!