Write a function that finds the average minimum and

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Write a function that finds the average, minimum and maximum values; and the integer which has the closest value to the midrange, given a sequence of positive integers as input. Notes: Midrange is the average of the minimum and maximum values in the input sequence. For instance, for the sequence “8 5 6 2 8 5 2 2 7 2 9 , midrange is (2 + 9) / 2 = 5.5 (where 2 and 9 are the minimum and maximum integers in the sequence respectively). In this case, the integer which has the closest value to the midrange is 5. If there is more than one integer with the closest value to the midrange, the output will contain only the integer appearing in the sequence before all the other integers which also have the closest value to midrange. As input to the program, total number of integers in the sequence and the sequence itself are entered respectively obeying the format for input as shown below. input 3: 18 25 1 6: 1 5 2 1 7 3 8: 32 64 4 13 5 2 4 8
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
output 14.7:1:25:18 3.2:1:7:5 16.5:2:64:32 Question 3 (25 Points) Write a program which calculates the average goals per match for teams given below. Program gets 2 weeks number and do the calculations for matches between these weeks and the result with three digit precision. For example if the user enters 3 and 7 then program will calculate the matches of the weeks 3,4,5,6,7. Week numbers will be different from each other and between 1 and 10 no more control is necessary. Average goal = Total( goal for (GF) - goal against (GA) ) / weeks Week GS BJK FB Number GF GA GF GA GF GA 1 1 1 0 1 6 0 2 4 0 2 1 2 0 3 2 2 2 0 2 1 4 2 2 3 1 1 2 5 1 1 2 3 4 2 6 1 0 0 1 1 1 7
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern