Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a simple program: We want to create a program that reads integer values and displays the average of those that are even, and those

Write a simple program:

image text in transcribed

image text in transcribed

We want to create a program that reads integer values and displays the average of those that are even, and those that are odd. The program should accepts input values until the user enters 999. We have the following fill-in template: print("This program calculates the average of even and odd numbers.") # Initialize accumulators and counters total_even = total_odd = count_even = count_odd = # Process input values )) while ...if % 2 == 0: ....total_even += ...count_even += ....else: ...total_odd += ..count_odd += )) ..count_odd += )) # Calculate averages if > ....print("Average of even numbers is", else: ....print("No even numbers input.") if ) ....print("Average of odd numbers is", else: ....print("No odd numbers input.") From the group of expressions below, drag into the appropriate places above the blocks needed to complete the program. avg_odd total_odd input int count_even x 1 count_odd -1 avg_even 0 999 "Enter nro.." total_even

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions