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

What does the following program do? student = 1 while student <= 3: total = 0 for score in range(1, 4): score = int(input("En

ter test score: ")) total += score average = total/3 print("Student ", student, "average: ", average) student += 1
Computers and Technology
1 answer:
OLga [1]3 years ago
6 0

Answer:

This program prompts for 3 score inputs and calculates the average score (of 3 Test scores) and repeats the process for 3 different students.

Explanation:

the programming language used is python

This is how the code should naturally look like:

student = 1

while student <= 3:

   total = 0

   for score in range(1, 4):

       score = int(input("Enter test score: "))

       total += score

       average = total/3

       print("Student ", student, "average: ", average)

  student += 1

To explain further i.e line by line

student = 1

This indicates that the scores that the program will prompt you to enter belong to the first student  

while student <= 3:

This is a continous loop that breaks only when the student number exceeds 3 (it lets you know that you're iterating over this program 3 times)

total = 0

this initializes the total score to zero. In python this is how variables are initialized an and assigned a data type especially when they will be used again within the program.

for score in range(1, 4):

      score = int(input("Enter test score: "))

The FOR loop is another control structure within the code. It allows you to Iterate between the range 1 - 4 ( i.e. 1,2,3) and prompts you to enter a test score 3 times.

total += score

for each time you are prompted to add a test score, the score is added to the total.

average = total/3

This line calculates the average by dividing by 3

print("Student ", student, "average: ", average)

This line prints out the student number and average score.

e.g: Student 1, average: 14

student += 1

This adds 1 to the previous students number to iterate to the next student.

Final Note: This code can be used for taking students test scores and calculating their average and can be modified further to check if a student passed of failed.

You might be interested in
Write the Q basic program to find the area of room.​
Mkey [24]

Explanation:

CLS

Input length

Input breadth

A= l*b

Print" the area of a room is"; A

END

8 0
2 years ago
The average price of milk increased from $3.00 last year to $3.50 this year. This is most likely due to:
Natali5045456 [20]

Answer:

High Demand

Explanation:

If more people want to buy something the price will likely go up.

4 0
3 years ago
Write a program that deliberately contains an endless or infinite while loop. The loop should generate multiplication questions
Westkost [7]

Answer:

The Java code is given below with appropriate variable names for better understanding

Explanation:

import java.util.Random;

import java.util.Scanner;

public class MultiplicationQuestions {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       Random rand = new Random();

       int n1, n2, result, total = 0, correct = 0;

       char ch = 'y';

       while(ch == 'y'){

           n1 = 1 + rand.nextInt(9);

           n2 = 1 + rand.nextInt(9);

           System.out.print("What is "+n1+" * "+n2+" ? ");

           result = scan.nextInt();

           if(result==n1*n2){

               System.out.println("Correct. Nice work!");

               correct++;

           }

           else{

               System.out.println("Incorrect. The product is "+(n1*n2));

           }

           System.out.print("Want more questions y or n ? ");

           ch = scan.next().charAt(0);

           total++;

       }

       System.out.println("You scored "+correct+" out of "+total);

   }

}

3 0
3 years ago
In modern computer memory, each location is normally composed of one byte.
Paraphin [41]
An actual parameter in a method call, or one of the values combined by an operator
4 0
3 years ago
Who is responsible for the actions of autonomous systems? (please help me :C)
Oksanka [162]

The responsibility for failures was deflected away from the automated parts of the system (and the humans, such as engineers, whose control is mediated through this automation) and placed on the immediate human operators, who possessed only limited knowledge and control.

8 0
3 years ago
Read 2 more answers
Other questions:
  • The illustrations group contains all but a _______​
    9·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • Which risk management framework does the organization of standardization publish
    13·1 answer
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • What is the most common concern with using variable frequency drives?
    6·1 answer
  • Write a program that prompts the user for the name of two files each containing a single line that represents a decimal integerc
    11·1 answer
  • Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
    14·1 answer
  • Sean Cody is a website most known for what?
    9·2 answers
  • Derek has to create a technical design of a complex floor plan using CAD. What will be most helpful for Derek to use to create t
    8·1 answer
  • Self-driving cars are a result of developments in which field of computer<br> science?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!