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
bezimeni [28]
3 years ago
6

Define a function below called process_grades. The function takes one argument: a list of integers. Each integer in the list cor

responds to a student's grade in a class. Complete the function such that it returns a new list where the integer grades are replaced by letter grades. For this question, use a standard grading scale without +/- grade, as follows A: 90-100 B: 80-89 C: 70-79 D: 60-69 F: < 60 For example, given the list [90, 85, 85, 72], the function should return ['A','B','B','C'].
Computers and Technology
1 answer:
stealth61 [152]3 years ago
8 0

Answer:

Following are the code in the Python Programming Language.

#define function

def process_grades(std_grades):

 result = []   #list type variable

 for grades in std_grades:   #set for loop

   if 90<=grades<=100:    #set if statement

     lettersGrade = 'A'   #variable initialization

   elif 80<=grades<=89:   #set elif statement

     lettersGrade = 'B'   #variable initialization

   elif 70<=grades<=79:   #set elif statement

     lettersGrade = 'C'    #variable initialization

   elif 60<=grades<=69:     #set elif statement

     lettersGrade = 'D'    #variable initialization

   else:    

     lettersGrade = 'F'    #variable initialization

   result.append(lettersGrade)     #append the value of lettersGrade in result

 return result      #print the value of the variable result

print(process_grades([90, 85, 85, 72]))   #call the function

Output:

['A', 'B', 'B', 'C']

Explanation:

Here, we define the function "process_grades" and pass an argument in the parameter list is "std_grades" in which we pass the grades of the students.

Then, we set the list data type variable "result" i9n which we store the grades of the students.

Then, we set the for loop and pass the condition.

Then, we set the "if-elif" statement and pass the conditions as given in the question.

Then, we append the value of the variable "lettersGrade" in the variable "result".

Finally, we call then function.

You might be interested in
.All of the following are true with the respect to implicitinvocation except:
katrin2010 [14]

Answer: D) components are instances of abstraction

Explanation:

As, implicit invocation is the process by which it is used by the the software designer for styling the architecture of the software,where the event handling structured are formed in the system. The main aim of the implicit invocation is to separated the conceptual concern for maintaining or improving the ability of the software engineer. It is basically based on the notion of the broadcasting and based on the event driven. The components are the instance of the abstraction which are not used as the components in implicit invocation which are relinquished control the system over the computational performance,this is the major disadvantage of the implicit invocation.  

6 0
2 years ago
What is the output of the following code snippet if the variable named cost contains 100? if cost &lt; 70 or cost &gt; 150 : dis
DanielleElmas [232]

Answer:

The output is: Your cost is  100

Explanation:

Given

The above code snippet

and

cost = 100

Required

Determine the output of the code

if cost < 70 or cost > 150

The above condition checks if cost is less than 70 or cost is greater than 150

This condition is false because 100 is neither less than 70 nor is it greater than 150

So, the else statement will be executed.

discount = cost

Which means

discount = 100

So, the print instruction will print: Your cost is  100

6 0
3 years ago
.Write a C++ program that displays your name and address (if you value your privacy, a fictitious name and address).
olga_2 [115]

Answer:

#include <iostream>

using namespace std;

int main() {

   cout<<"My name is Rajat Sharma"<<endl<<"My address is Flat no=23 GH=5 Paschim Vihar New Delhi 110087 India"<<endl;

return 0;

}

Explanation:

The program is written in C++ language.In the program I have used cout to print my name and the address.First the name will be printed then the address in the new line endl is used for new line.To print any sentence just put them in double quotes.The same sentence in the program will be printed on the screen.

5 0
3 years ago
To add slides to a presentation, _____.
Effectus [21]
<span>select the New Slide option from the Insert menu</span>
7 0
3 years ago
What are organization tools?
Nonamiya [84]
An app or software created to optimize your daily task performance
4 0
3 years ago
Other questions:
  • you are a software engineering consultant and have been called in by the vice president of finance of a corporation that manufac
    10·1 answer
  • The ________ multiple-selection PHP statement is used to handle decision making and can be used to replace multiple if and if...
    12·1 answer
  • Write a while statement that prints all even numbers between 1 and 100 to the screen.
    6·1 answer
  • A ____ by a design professional is used to determine the best system to provide the appropriate level and type of protection.
    6·1 answer
  • The main purpose of a constructor is to initialize the data members at the moment that an object is created. true or false?
    8·1 answer
  • I have a question on an IT crossword the question is as follows
    12·1 answer
  • To maintain her audience's confidence in her, what should kiara not do while delivering her presentation?
    10·1 answer
  • A user purchased a new smart home device with embedded software and connected the device to a home network. The user then regist
    5·1 answer
  • What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:
    15·1 answer
  • How would a person giving a persuasive speech use projection to make a key point?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!