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

Suppose we have a dictionary called grades as shown below:

Computers and Technology
1 answer:
mihalych1998 [28]3 years ago
6 0

Answer:

import statistics as st # importing statistics package to calculate mean as st.

grades = {"John": [87,90,86.8], "Mary": [78, 81.5, 88.6],"Susan":[45,67,76]}

for key,value in grades.items():#iterating over the dictionary

   average_score=st.mean(value)#calculating the mean of every student

   gr="" empty string to store the grades

   if average_score>=90: # nested if else if and statements for the grades in gr

       gr="A"

   elif average_score>=80.0 and average_score<90.0:

       gr="B"

   elif average_score>=70.0 and average_score<80.0:

       gr="C"

   elif average_score>=60.0 and average_score<70.0:

       gr="D"

   else :

       gr="F"

       

   print(str(key)+" "+str(average_score)+" "+str(gr)) #printing grades of every student.

Output:-Mary 82.7 B

John 87.93333333333334 B

Susan 62.666666666666664 D

Explanation:

1.In this program we are iterating over the dictionary grades.

2.Storing and calculating the mean of the scores of every student us statistics package.

3.Storing the grade in string gr and updating the gr according to the mean score

4.After that printing the grade of the student with their name and mean score.

You might be interested in
What options does the business user have to manually share individual records? A new custom object is being created with a priva
lutik1710 [3]

<em>The answer is C. </em>

<em>The business user or admin must set rules or permission per user or user groups that would allow him to decide how each user or group would use the shared folder or records. One user or group can just view the record, other may have access on it and can edit the files. </em>

6 0
3 years ago
What determines how a system will work to meet the business needs defined during system investigation?
devlian [24]
I think, that it consists of (includes); Design, Performance; etc.
8 0
3 years ago
Retail products are identified by their Universal Product Codes (UPCs). The most commonform of a UPC has 12 decimal digits: The
Dahasolnce [82]

Answer:

#include <iostream>

#include <cmath>

using namespace std;

int main(){

   string upc;

   char last;

   cout<< "Enter UPC number: ";

   cin >> upc;

   if (upc.size() == 12){

       last = upc[-1];

   } else{

       return 0;

   }

   cout<< last;

   char myArr[upc.length()];

   for (int i = 0 ; i < upc.substr(0,11).length(); ++i){

       if (upc[i]%2 != 0){

           myArr[i] = upc[i] * 3;

       }

       else{

           myArr[i] = upc[i];

       }

   }

   int sum = 0;

   for (int x = 0; x < sizeof(myArr); ++x){

       sum += (int)myArr[x] - '0';

   }

   if (sum% 10 == last){

       cout<<"UPC number is valid";

   }

   else{

       cout<<"Invalid UPC number.";

   }

}

Explanation:

The UPC number in the c++ source code input must be 12 digits long for the rest of the code to execute.  The code checks the validity of the number by comparing the reminder of the sum division with the last digit in the UPC number.

8 0
3 years ago
Write a recursive function, replace, that accepts a parameter containing a string value and returns another string value, the sa
kirill [66]
You should state what language you want your answer to be in before you ask programming questions. Here is what you're looking for in Java:

<span>public static String replace(String str) {
    return str.replace(' ', '*')<span>;
</span>}</span>
6 0
3 years ago
DOES ANYONE KNOW COMPUTER SCIENCE?
Maru [420]

Answer:

statClass.java

Explanation:

You use the classname of the public class.

One of those will contain main()

Note that this example has a typo. statClass vs startClass.

6 0
2 years ago
Other questions:
  • Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map province
    11·1 answer
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • Do you think cyber-bulling is more damaging, as damaging, or less damaging than in-person bullying? Why?
    11·2 answers
  • Is it necessary that every autonomous system use the same intra-AS routing algorithm? Why or why not?
    10·1 answer
  • What problems have arisen regarding use of the Internet for global business transactions, and how are they being resolved?
    15·1 answer
  • Which of the following components helps to limit the front-to-back movement of the crankshaft? 
    9·2 answers
  • . How do you find and remove files whose names contain embedded spaces? What would the Linux command(s) be?
    12·1 answer
  • It is an electronic device that capable of accessing accepting processing product and storing data​
    13·1 answer
  • Explain input device​
    9·2 answers
  • Write a function float Average(int, int) that finds the mean, and then write a main program that inputs two numbers from the use
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!