Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Question 3 The time allocated for this question is 15 minutes. At the end of this period, please go to the next question. Otherwise,

image text in transcribed

python

Question 3 The time allocated for this question is 15 minutes. At the end of this period, please go to the next question. Otherwise, you may have trouble with the time for the remaining questions. This question is 20 pts. In this program you need to find the average of the numbers which are odd in the list. To implement this question, firstly get n from the user. n is the total number of the items in the list. After getting n value from the user, you can generate 2 random numbers for the starting and ending point of the range of the numbers. Finally, write a function that returns the average of the values that are odd. The prototype of the function is findAverage(start, end); float. You can see the example in the sample output. Do not forget that numbers must be random. Sample Output: Enter the number of items: 5 #This number is a user input which shows the total number of the elements of the list. Random numbers: start: 15 #starting point end: 150 #ending point #After getting n and generating the limits (start and end), call the function findAverage(start, end) #This function generates n items between start and end points. You can see 5 random numbers between 15 and 150.(NUMBERS ARE EXAMPLE! YOUR NUMBERS MUST BE RANDOM NUMBERS!) List - 20, 120, 15, 60, 35 #Generate n (5) numbers, then show all of them on the console. Total Sum - 25 #Show the average of the values which are odd. Activate W Go to Settings

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions