1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
katen-ka-za [31]
3 years ago
13

This assignment involves writing a Python program to compute the average quiz grade for a group of five students. Your program s

hould include a list of five names. Using a for loop, it should successively prompt the user for the quiz grade for each of the five students. Each prompt should include the name of the student whose quiz grade is to be input. It should compute and display the average of those five grades and the highest grade. You should decide on the names of the five students. Your program should include the pseudocode used for your design in the comments.

Computers and Technology
1 answer:
umka21 [38]3 years ago
3 0

Answer:

Here is the Python program along with the comments of program design

#this program is designed to compute the average quiz grades for a group of five students  

students = ["Alex", "John", "David", "Joseph", "Mathew"] #create a list of 5 students  

grades = []  # create an empty list to store the grades in  

for student in students: #loop through the students list  

   grade = input("Enter the quiz grade for "+student+": ") #prompt the user for the quiz grade of each student

   #store the input grades of each student to grade

   grades.append(int(grade))  # convert the grade to an integer number and append it to the list  

print("Grades are:", grades) #display the grades of five students  

average = sum(grades) / len(grades) #compute the average of five grades  

print("The average of grades is:", average) #display the average of five grades  

highest = max(grades) #compute the highest grade

print("The highest grade is:", highest) #print highest grade  

Explanation:

The program first creates a list of 5 students who are:

Alex

John

David

Joseph

Mathew

It stores these into a list named students.

Next the program creates another list named grades to store the grades of each of the above students.

Next the program prompts the user for the quiz grade for each of the five students and accepts input grades using input() method. The statement contains student variable so each prompt includes the name of the student whose quiz grade is to be input. Each of the grades are stored in grade variable.

Next the append() method is used to add each of the input grades stored in grade to the list grades. The int() method is used to first convert these grades into integer.

Next print() method is used to display the list grades on output screen which contains grades of 5 students.

Next the average is computed by taking the sum of all input grades and dividing the sum by the total number of grades. The sum() method is used to compute the sum and len() method is used to return the number of grades i.e. 5. The result is stored in average. Then the print() method is used to display the resultant value of average.

At last the highest of the grades is computed by using max() method which returns the maximum value from the grades list and print() method is used to display the highest value.

The screenshot of the program and its output is attached.

You might be interested in
Which of the following is a characteristic of vector graphics?
Alex73 [517]

Answer:

A

Explanation:

Vector graphics consist of mathematical descriptions of shapes as a combination of these numerical vectors. Because the vector graphics define the path that the lines should take, rather than a set of points along the way, they can be used to calculate any number of points, and so can be used at any image resolution.

4 0
3 years ago
Read 2 more answers
Write the count below the rests. <br><br> How do I do I do this?<br> Help guys
leva [86]
Well 1234 for the first one
7 0
3 years ago
What term defines Internet applications that help people connect with each other through a virtual environment by providing them
andreev551 [17]
D. social networks is your answer
4 0
4 years ago
____ map a set of alphanumeric characters and special symbols to a sequence of numeric values that a computer can process.
Neporo4naja [7]
The answer is : coding schemes
4 0
3 years ago
Create a simple main() that solves the subset sum problem for any vector ofints. Here is an example of the set-up and output. Yo
ivolga24 [154]

Answer:

The main function is given below. Appropriate comments are made where necessary. In addition to this, I added a full code for the problem to help you understand it fully

Explanation:

// Sublist.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include <vector>

using namespace std;

int sumInStack = 0;

int TARGET_SUM = 180;

vector<int> choices;

void subList(vector<int> data, int fromIndex, int endIndex);

void print();

int main()

{  

  vector<int> dataSet;

  int k, j, fromIndex,endIndex;

  bool foundPerfect;

  dataSet.push_back(20); dataSet.push_back(12);     dataSet.push_back(22);

  dataSet.push_back(15); dataSet.push_back(25);

  dataSet.push_back(19); dataSet.push_back(29);

  dataSet.push_back(18);

  dataSet.push_back(11); dataSet.push_back(13); dataSet.push_back(17);

  choices.clear();

  fromIndex=0;

  endIndex=dataSet.size();

  cout << "Target time: " << TARGET_SUM << endl;

  subList(dataSet, fromIndex, endIndex);

  // code provided by student

  system("pause");

  return 0;

}

void subList(vector<int> data, int fromIndex, int endIndex) {

       /*

       * Check if sum of elements stored in Stack is equal to the expected

       * target sum.

       *

       * If so, call print method to print the candidate satisfied result.

       */

       if (sumInStack == TARGET_SUM)

         {

          print();

       }

       for (int currentIndex = fromIndex; currentIndex < endIndex; currentIndex++)

         {

           if (sumInStack + data[currentIndex] <= TARGET_SUM)

             {

                  choices.push_back(data[currentIndex]);

               sumInStack += data[currentIndex];

               /*

               * Make the currentIndex +1, and then use recursion to proceed

               * further.

               */

           subList(data, currentIndex + 1, endIndex);

                  sumInStack -= choices.back();

                  choices.pop_back();

           }

       }

   }

void print()

{

    cout<<TARGET_SUM<<" = ";

    for(int i=0;i<choices.size();i++)

    {

         cout<<choices.at(i)<<"+";

    }

}

8 0
4 years ago
Other questions:
  • Provide the code to insert a subtitle track named "Spanish Version" using the track text in the spanish.vtt file and the Spanish
    9·1 answer
  • Can anyone help me with edhesive 4.2 Question 1 ???
    11·2 answers
  • What is Blender's default save directory for movie AVI files?
    9·2 answers
  • All of the following are good reasons to attend a cummunity college except
    10·2 answers
  • Create a query that will list all technician names, employee numbers, and year hired in order by year hired (Newest to Oldest).
    5·1 answer
  • Heelo how do u do python syntax lesson 11 on code academy
    12·1 answer
  • Which of the following represents the TCP/IP four-layer reference model? Group of answer choices Application, Internet, transpor
    11·1 answer
  • Which three skills are useful for success in any career?
    8·1 answer
  • With what software tool can you see the applications that are currently runni
    13·1 answer
  • Suppose that we want to enhance the processor used for Web serving. The new processor is 10 times faster on computation in the W
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!