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
anzhelika [568]
3 years ago
9

Write a program to calculate student's average test scores and the grade. You may assume the following input data:

Computers and Technology
1 answer:
Brums [2.3K]3 years ago
7 0

Answer:

def gradeAverage():

   grades = []

   i = 0

   while i < 5:

       a = int(input('enter score ' + str(i + 1) + ': '))

       grades.append(a)

       i = i+1

   #print(grades)

   average = sum(grades)/len(grades)

   #print(average)

   return average

def lettergrade(a):

   letter = 'A'

   if a < 60:

       letter = 'F'

   elif 59 < a < 63:

       letter = 'D-'

   elif 62 < a < 67:

       letter = 'D'

   elif 66 < a < 70:

       letter = 'D+'

   elif 69 < a < 73:

       letter = 'C-'

   elif 72 < a < 77:

       letter = 'C'

   elif 76 < a < 80:

       letter = 'C+'

   elif 79 < a < 83:

       letter = 'B-'

   elif 82 < a < 87:

       letter = 'B'

   elif 86 < a < 90:

       letter = 'B+'

   elif 89 < a < 94:

       letter = 'A-'

   elif 93 < a < 101:

       letter = 'A'

   return letter

numOfStudents = int(input('How many students: '))

names = []

aver = []

grade =[]

while numOfStudents > 0:

   studentName = input('Enter students name: ')

   names.append(studentName)

   a = gradeAverage()

   aver.append(a)

   grade.append(lettergrade(a))

   numOfStudents = numOfStudents - 1

for name in names:

       for score in aver:

           for letter in grade:

               if names.index(name) == aver.index(score) == grade.index(letter):

                   print('%s : Average =  %d  Letter Grade:  %s \n' %(name, score, letter))

                   break

Explanation:

The programming language used is python.

Two functions were created, the first function gradeAverage() was used to calculate the average values of the scores.

The second function lettergrade(a) was used to get the letter grade i.e(A, A-, C, D, e.t.c.) and it takes its argument from the average.

The main block of code asks for how many students are there and prompts the user to input their names and scores for all the students.

It takes that data calculates the average and the letter grade and prints out the names of the students, their average and their letter grade.

You might be interested in
A computer needs both hardware and to be useful
riadik2000 [5.3K]

Answer:

Software? or a person?

5 0
3 years ago
Read 2 more answers
azure claims there are 54 regions. but when i create my account, i can only see 30 or so. what happened to the other regions?
stira [4]

Explanation:

Some regions may not have the full suite for the utilization of the Microsoft Azure platform or they may possess limited capabilities for them to fully function.

6 0
3 years ago
Two hundred workstations and four servers on a single LAN are connected by a number of switches. You’re seeing an excessive numb
quester [9]

Answer:

Add more servers or decrease the amount of workstations

5 0
3 years ago
Show the printout of the following code. public class Test { public static void main(String[] args) { double[][] m = {{1, 2, 3},
gtnhenbr [62]

Answer:

The answer to the given question is "3.6".

Explanation:

The printout description of the given java program can be given as:

In this program, the printout of the following code is 3.6. because in this program we define an array and assign elements on the array and calculate the sum of the elements but in the loop, we calculate the sum of rows value that is i [1][1]= 1.0, i [2][2]=2.5 and i [3][3]=0.1  then we calculate sum that is equal to 3.6.

That's why the answer to this question is "3.6".  

7 0
4 years ago
Look at the following partial class definition, and then respond to the questions that follow it:
zhannawk [14.2K]

Solution :

a.

public Book($\text{String title}$, String author, $\text{String publisher}$, int $\text{copiesSold}$) {

 this.$\text{title}$ = $\text{title}$;

 this.$\text{author}$ = $\text{author}$;

 this.$\text{publisher}$ = $\text{publisher}$;

 this.$\text{copiesSold}$ = $\text{copiesSold}$;

b). $\text{public String}$ getTitle() {

 return $\text{title}$;

}

$\text{public void}$ setTitle($\text{String title}$) {

 this.$\text{title}$ = $\text{title}$;

}

$\text{public String}$ getAuthor() {

 return author;

}

$\text{public void}$ setAuthor(String author) {

 this.$\text{author}$ = $\text{author}$;

}

$\text{public String}$ getPublisher() {

 return $\text{publisher}$;

}

$\text{public void}$ setPublisher(String $\text{publisher}$) {

 this.$\text{publisher}$ =$\text{publisher}$;

}

public int get$\text{copiesSold}$() {

 return $\text{copiesSold}$;

}

$\text{public void}$ set$\text{copiesSold}$(int $\text{copiesSold}$) {

 this.$\text{copiesSold}$ = $\text{copiesSold}$;

}

4 0
3 years ago
Other questions:
  • Which of the following has the responsibility of offering instruction on intrusion detection systems and intrusion prevention sy
    11·1 answer
  • If you have an application that is not responding and you want to force it to shut down, whichsystem utility can you use?
    8·1 answer
  • A wireless mesh network with 17 computers would need _______________ connections.
    13·1 answer
  • Susie works for an architectural firm and the partners have always drawn the plans for projects by hand. Though Susie learned ho
    8·1 answer
  • A person who has a been exposed to technology at a young age is?
    8·1 answer
  • Which recovery method usually involves an evasion effort and is dependent on the ip's condition?
    11·1 answer
  • What happens if two functions are defined with the same name, even if they are in different arguments within the same .py files?
    10·1 answer
  • My friend has a battery of 9000mah and loses 10 every day how many days well it take to go to zero
    13·1 answer
  • Match the image to the view type in a presentation program. scroll bar tool bar status bar menu bar provides an array of buttons
    10·2 answers
  • Which three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!