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
Nina [5.8K]
2 years ago
13

Write a program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name wil

l be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name. Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores. determine_grade - this function should accept a test score average as an argument and return a letter grade for the score based on the following grading scale: 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F
Computers and Technology
1 answer:
sergeinik [125]2 years ago
3 0

Answer:

// program in Python

# function to find grade

def grade(t_score):

   #grade A

   if t_score >=90:

       return 'A'

       #grade B

   elif t_score >=80 and t_score <90:

       return 'B'

   #grade C

   elif t_score >=70 and t_score <80:

       return 'C'

   #grade D

   elif t_score >=60 and t_score <70:

       return 'D'

   #grade F

   else:

       return 'F'

# function to find average score

def calc_average(test_score):

   #variable to find sum

   total = 0

   for i in range(len(test_score)):

       #calculate total score

       total = total + test_score[i]

   # find average

   return total/float(len(test_score))

#array to store score

test_score = []

#read name of student

name = input("Enter student's name: ")

for i in range(8):

   #read score

   t_score = int(input("Enter the score {}: ".format(i+1)))

   #add score to array

   test_score.append(t_score)

#call function to find Average

averageScore = calc_average(test_score)

#print name of Student

print("Student Name: ", name)

#print each Score

for i in range(len(test_score)):

   #print each Score and Grade

   print("Score: ",test_score[i], "Letter Grade: ",grade(test_score[i]))

# print Average Score

print("Average Score: ", averageScore)

Explanation:

Read name of student from user.Then read 8 test scores from user. Call the function grade() to find the grade of a test score.Call the function calc_average() to  find the average score of all test.Print each score and corresponding grade and print  average score.

Output:

Enter student's name: Sam                                                                                                  

Enter the score 1: 45                                                                                                      

Enter the score 2: 98                                                                                                      

Enter the score 3: 67                                                                                                      

Enter the score 4: 86                                                                                                      

Enter the score 5: 60                                                                                                      

Enter the score 6: 77                                                                                                      

Enter the score 7: 92                                                                                                      

Enter the score 8: 32                                                                                                      

Student Name:  Sam                                                                                                        

Score:  45 Letter Grade:  F                                                                                                

Score:  98 Letter Grade:  A                                                                                                

Score:  67 Letter Grade:  D                                                                                                

Score:  86 Letter Grade:  B                                                                                                

Score:  60 Letter Grade:  D                                                                                                

Score:  77 Letter Grade:  C                                                                                                

Score:  92 Letter Grade:  A                                                                                                

Score:  32 Letter Grade:  F                                                                                                

Average Score:  69.625  

You might be interested in
Yolanda first breaks down the whole game she needs to program into modules. She then breaks these modules into smaller modules u
Tcecarenko [31]
That’s coo. What’s the question?
5 0
3 years ago
Google’s adwords system provides a quality score as a measure of _____, which indicates the usefulness of an ad message to consu
Vanyuwa [196]
The term that best fit the blank is RELEVANCE. The Google Adwords system is a system that is created by Google for the purpose of advertising online. Therefore, relevance is very important in this aspect as this shows how useful the ad is to the consumers who are doing the google search.
3 0
2 years ago
Write a Java program in jGRASP that creates a 2D integer array of 5 rows and 20 columns, fills it with increasing integer values
Alex73 [517]

Answer:

As per the question we need to make 5 rowa and 2o columns, in this we have total element 100 so range should be 0 to 99, but we are suggested to keep range 0 to 59, so i have kept the elementns in the range, but if it was a typo in the question for range you do not need to reset the k with zero.

Explanation:

//create a new class  TestArray

public class TestArray {

//define main method

public static void main(String[] args) {

 //declare a 2D array of given size i.e. 5 rows and 20 columns

 int arr[][] = new int[5][20];

 //declare an integer variable k and initialize it with zero, this will used to initialize the array from 0 to 99

 int k = 0;

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //initialize arr with the current value of k

   arr[i][j] = k;

   //once k is 59 set it zero again as we are not going beyond 59

   if(k == 59)

    k = 0;

   //increment value of k with 1

   k++;

  }

 }

 //print the element from the array one by one

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //print the current element of array and an space with it

   System.out.print(arr[i][j]+" ");

  }

  // move the cursor to new line

  System.out.println();

 }

}

}

7 0
3 years ago
Which area located at the top of the word screen includes home , insert , and page layout ?
Misha Larkins [42]

Answer:

Whats your qeustion

Explanation:

4 0
3 years ago
Read 2 more answers
Five features of any window​
Vesna [10]

Answer:

The features of any windows are

1. Start menu

2. Notification area or task bar

3. Window snipping tools

4. Using Local Area Networks

5. Windows explorer libraries

Explanation:

8 0
2 years ago
Other questions:
  • What are the most popular/up-and-coming social media applications?
    10·2 answers
  • To display measurements on the ruler while changing column widths, hold down the ________ key while dragging the marker.
    13·1 answer
  • Joshua takes ownership of all his tasks. Which quality is he demonstrating?
    9·2 answers
  • Research information technology affects on job market, career pathways, occupational outlooks in business and finance and synthe
    7·1 answer
  • IT investments can lead to developing IT capabilities and dynamic IT competencies, which can lead to achieving the following six
    5·1 answer
  • I can't find the errors! Could anyone help me please?!
    5·1 answer
  • To exit Access, click the ____ button on the right side of the Access title bar.
    9·1 answer
  • Which statement is NOT CORRECT?
    11·1 answer
  • Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters.
    7·1 answer
  • __________ implements a security policy that specifies who or what may have access to each specific system resource and the type
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!