Question: Manipulate multiple arrays, of different types using loops. The program will build a small database of student names and marks, then print the average mark,

Manipulate multiple arrays, of different types using loops. The program will build a small database of student names and marks, then print the average mark, the student with the highest mark, and the student with the lowest mark. In order:

1. The program will prompt the user with "How many students are there? ", then read in a positive integer n (you don't have to deal with bad input, but you do have to remember what to do with the newline generated by the user input).

2. The program will then read in n student names and marks with prompts "Enter name of student i: " and "Enter mark i: ", where i is replaced by a number from 1 to n, in order. Again, remember that user input generates newlines in the input stream you have to deal with.

3. The program will then print "The average mark is: " and print the average mark together on their own line.

4. The program will then print "The best student is " and print the student's name together on their own line.

5. The program will then print "The worst student is " and print the student's name together on their own line.

Prompts do not need a newline - that will come from the data entry by the user.

The best and worst student are determined by the highest and lowest mark respectively. The best and worst mark will be unique.

An example with both input and output would be:

Enter name of student 1: Luke

Enter mark 1: 50

Enter name of student 2: Cat

Enter mark 2: 99

Enter name of student 3: Nick

Enter mark 3: 98

Enter name of student 4: Mazza

Enter mark 4: 98

The average mark is: 86.25

The best student is Cat

The worst student is Luke

Step by Step Solution

3.54 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a Python program that accomplishes the task of building a small database of student names and ... View full answer

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 Computer Network Questions!