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
Give three general reasons for the importance of computer networking.
LiRa [457]
I think the First reason is; it provides the best way of business communication.
Second reason, streamline communication
Third reason cost effective resource sharing :) (hope this helps)
5 0
3 years ago
Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
NemiM [27]

Internet Explorer 9+ is the web browser recommended to use with recorders.

<h3>What is a web browser?</h3>

Anywhere on the internet is reachable with a web browser. It pulls data from other websites and shows it on your smartphone or computer. The HTTP Send Standard, which outlines how text, pictures, and audio are communicated on the web, is employed to transfer the data.

As we know,

Recorders are perfect for desktop applications because they can record a variety of items, including mouse clicks, scrolling, radio buttons, list boxes, checkboxes, and drop-down menus.

Thus, Internet Explorer 9+ is the web browser recommended to use with recorders.

Learn more about the web browser here:

brainly.com/question/19459381

#SPJ4

6 0
1 year ago
Write a program that reads a file containing text. Read each line and send it to the output file, preceded by line numbers. If t
Shtirlitz [24]

Answer:

I am writing a JAVA program:

import java.io.FileReader;  // class used for reading data from a file

import java.io.IOException;  //class used for handling exceptions

import java.io.PrintWriter;  // class used to printing or writing formatted data. It is used when the data to be written contains text and numbers

import java.util.Scanner;   // class used to take input from the user

public class Main  {  //start of the class

public static void main(String[] args)  {//start of main() function body

Scanner input = new Scanner(System.in);  //creates Scanner class object

System.out.print("Enter the input file name: ");  // prompts user to enter the input file name

String input_file = input.next();  //to  read and return the token i.e. input file name and store this into input_file String type variable

System.out.print("Enter the output file name: "); // prompts user to enter the output file name

String output_file = input.next();   /to  read and return the token i.e. output file name and store this into output_file String type variable

try   {/* try  defines a chunk of code to be tested for errors during the execute of this chunk. its a code block for reading from input file and writing to output file. This handles the exception if program cannot create or write to the file indicated. */

   FileReader inFile = new FileReader(input_file);  //creates object inFile of FileReader class to read the input_file contents

   Scanner scan = new Scanner(inFile);  //read and scans the input file

   PrintWriter outFile = new PrintWriter(output_file);  //creates object outFile of PrintWriter class to write to the output file. It is used to write output data in a readable text form.

   int count = 1;    //counts the line number      

   while (scan.hasNextLine())  {  //loop keeps checking for the next line in input file

    String lines = scan.nextLine();  // reads the entire line of the input file and stores that line contents in String lines

    outFile.println("/* " + count + " */ " + lines);  //each line represented with line number enclosed in /* */

    count++;  }   //increments the line number at each iteration    

    outFile.close();        }  //closes the output file after writing the contents from input file with each line of the input file enclosed in  /* */

catch (IOException e)  {  // catching the IOException and prints the following message if program cannot create input_file or write to the output_file

   System.out.println("Error processing file: " + e);    }     }   }

Explanation:

The program is well explained in the comments mentioned with each statement of the above program. The user is prompted to enter input and output file names. Then the program uses a while loop that scans through lines of the input file and count variable counts each line of input file. Then at each iteration the count variable counts a line of input file and line number of each line of the input file is enclosed in /* */ delimiters. The contents of input file, in which the line numbers of text lines of the input file are enclosed in /* */ delimiters, is written to the output file.

The screenshot of the program is attached along with the output file produces as a result of this program execution.

7 0
3 years ago
Convert A4B from hexadecimal to binary. Show your work.
Rama09 [41]

Answer:

The answer is A4B₁₆ =  2635₁₀ =  101001001011₂

Explanation:

To convert from hexadecimal base system to binary base system, first you can do an intermediate conversion from hexadecimal to decimal using this formula:

where position of the x₁ is the rightmost digit of the number and the equivalents hexadecimal numbers to decimal:

  • A = 10.
  • B = 11.
  • C = 12.
  • D = 13.
  • E = 14.
  • F = 15.

A4B₁₆ = A*16²+4*16¹+B*16⁰ = 2560 + 64 + 11 = 2635₁₀

Now, you have the number transformed from hexadecimal to decimal. To convert the decimal number 2635 to binary: Divide the number repeatedly by 2, keeping track of each remainder, until we get a quotient that is equal to 0:

2635 ÷ 2 = 1317 + 1;

1317 ÷ 2 = 658 + 1;

658 ÷ 2 = 329 + 0;

329 ÷ 2 = 164 + 1;

164 ÷ 2 = 82 + 0;

82 ÷ 2 = 41 + 0;

41 ÷ 2 = 20 + 1;

20 ÷ 2 = 10 + 0;

10 ÷ 2 = 5 + 0;

5 ÷ 2 = 2 + 1;

2 ÷ 2 = 1 + 0;

1 ÷ 2 = 0 + 1;

Now, construct the integer part base 2 representation, by taking the remainders starting from the bottom of the list:

2635₁₀ =  101001001011₂

3 0
3 years ago
Before you enter an intersection on a green light make sure
mr Goodwill [35]

Answer:

there is no pedestrians and everyone is stopped at their designated red light

5 0
3 years ago
Read 2 more answers
Other questions:
  • How to the inverse function of f(x)=x2 +1 ,x&gt;o
    5·1 answer
  • The first electronic networking technology widely used in the United States was the:
    6·1 answer
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • Which relationship is possible when two tables share the same primary key? one-to-one one-to-many many-to-one many-to-many
    15·2 answers
  • Internet access is now available in what percentage of schools?
    7·2 answers
  • If you want three vertical sections of text on your page, create _____. dividers columns page breaks bulleted lists
    7·2 answers
  • Compose one paragraph (three to four sentences) explaining the difference between a courtesy copy and a blind courtesy copy (thi
    9·1 answer
  • Software is the word for:
    15·1 answer
  • What is a network computer that processes requests from a client server​
    11·1 answer
  • alle Mbawah: Attempt 1 How does a bystander become an advocate? By harassing the bully until he or she stops the harmful activit
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!