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
nydimaria [60]
3 years ago
9

Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue acce

pting scores until the user enters a negative value. Finally, calculate and display the average for the entered scores.
Computers and Technology
1 answer:
fomenos3 years ago
6 0

Answer:

total = 0

count = 0

while(True):

   grade = float(input("Enter a grade: "))

   if grade < 0:

       break

   else:

       total += grade

       count += 1

       

average = total/count

print("The average is: " + str(average))

Explanation:

*The code is in Python.

Initialize the total and count as 0

Create a while loop that iterates until a specific condition is met inside the loop

Inside the loop, ask the user to enter a grade. If the grade is smaller than 0, stop the loop. Otherwise, add the grade to the total and increment the count by 1.

When the loop is done, calculate the average, divide the total by count, and print it

You might be interested in
Now, extend your test program by adding a second function named split that will identify all the individual values in a comma se
otez555 [7]

Answer:

The code to copy is :

#include <iostream>

#include <string>

using namespace std;

string nextString(string str, int start_index);

int split(string str, string a[], int max_size);

int main()

{

const int VALUES = 20;

string somestring;

string varray[VALUES];

//Prompt the user to enter a comma separated string

cout << "Enter a comma seperated string: ";

//read the string

getline(cin, somestring);

//call split() method on the given string and

//store the count of individual strings in cnt

int cnt = split(somestring, varray, VALUES);

//Print the individual strings

for (int i = 0; i<cnt; i++)

cout << varray[i] << endl;

return 0;

}

//returns a sub string that starts at strat_index

//in the given string and ends before a comma

string nextString(string str, int start_index)

{

int i;

//find a comma or end of the string, after strat_index

for (i = start_index;i < str.length();i++)

{

//if comma is found, exit the loop

if (str.at(i) == ',')

break;

}

//extract the sub string

string out= str.substr(start_index, i-start_index);

return out;

}

//splits the comma separted string as individual strings

//and returns the number of individual strings

int split(string str, string a[], int max_size)

{

int i, j;

int start_index = 0;

//search for commas in the given string

for (i = 0,j=0;i < str.length();i++)

{

//if comma is identified or end of the string is identified

//, then get a strig that starts at start_index using next string

if (str.at(i) == ',' ||i==str.length()-1)

{

//save each string into an array of strings

a[j] = nextString(str, start_index);

//update the next string starting postion(starts after comma)

start_index = i + 1;

j++;

}

}

return j;

Explanation:

Please see attachments

7 0
3 years ago
What must you use to create a multi-line string?
IrinaK [193]

Answer:

A single pair of three consecutive double quotation marks.

Explanation:

In Python, a multi-line string can be created by enclosing it in three double quotation marks. For example:

string = """This is a Python multi-line string

This is used to print string in multiple lines

This uses three consecutive quotation marks"""

print(string)

Output:

This is a Python multi-line string

This is used to print string in multiple lines

This uses three consecutive quotation marks

In addition to using three double quotation marks, \n and brackets ( ) are also used to create multi-line string in Python.

7 0
3 years ago
What is the difference between organizing your data in a list and organizing it in a data extension?
azamat

The difference between organizing your data in a list and organizing it in a data extension is that in a list, you organize subscribers by name. In a data extension, you organize them by region.

<h3>What is Data extension?</h3>
  • A data extension contains contact information. A data extension is just a table with fields for contact information.
  • Data extensions can work independently or in conjunction with other data extensions.
  • The data may be used for searches, information retrieval, and sending to a selection of subscribers.
  • You have two options for importing data extensions: manually or automatically using Automation Studio or the Marketing Cloud API.
  • Both Contact Builder and Email Studio allow the usage of data extensions, but Email Studio is the only place where sharing, permissions, and other features are available.

To learn more about data extension, refer to the following link:

brainly.com/question/20388719

#SPJ4

7 0
1 year ago
The color encoding we’re using is RGB.What does this mean,in terms of the amount of memory required to represent color? Is there
DanielleElmas [232]

Answer:

RGB

Explanation:

R=red

G=Green

B=Blue

RGB is standard scheme of colors ,rest of the colors use to be make by mixing three of these colors. These are standard colors use for monitor,computer and Tv screen.

RBG plays an vital role in the memory of the computer. For example the JPG file is RBG-24 bit file. So it is easy to upload the file that is JPG and it is easy to edit and upload. This file is taking less RAM so the editors usually keeps the JPG file along with them because it is easy to compress and edit the file.

Hence it is proved that RGB color coding is very efficient for the usage of the memory because it is already a compressed file and use the RAM so efficiently, so the quality of task done by CPU would never be compromised by using RGB.

Large photo is usually composed of more colors and the computer use to struggle alot for such iamge files.

The RGB code (0-255 for each of R, G, B) carrirs  16777216 possible matches. It's not almost "every new color," but it made up more than most of the colors humans can easily identifies.

we must say that RGB is not the perfect choice for making every possible color that is existing but it is quite helpful in making every unique color that a human could identify. RGB is mostly makes the light color with the combination of these three colors.

RGB is not the best for making every possible color but it is so useful as far as the computer memory is concern it uses very less memory and it file is quite light. Uploading of JPG file is easy ,it takes less time and memory.

On clouds the memory is most important element so, mostly the RGB are preferred colors and these are enough to represent in compute scheme.

8 0
3 years ago
Which code segment will guarantee that the robot makes it to the grey square without hitting a wall or a barrier (black square)
klemol [59]

Answer:

function solveMaze(){ moveForward(); moveForward(); rotateRight(); while(canMove("forward")){ moveForward(); } rotateLeft(); moveForward(); }

Explanation:

took the test

4 0
1 year ago
Other questions:
  • What is the size of the key space if all 8 characters are randomly chosen 8-bit ascii characters?
    6·1 answer
  • To select all the text in a document, press ____.
    12·2 answers
  • Please someone help me I hate python
    11·1 answer
  • Please help! (I cant figure out)
    13·1 answer
  • Ng/ Computer Applications - Office 2016 - EL3520 A
    13·1 answer
  • Which of the following are screen objects used to maintain, view, and print data from a database
    9·1 answer
  • Why can’t I “change the country” on settings??<br> (In this app)
    13·1 answer
  • How to use repl.it css
    7·1 answer
  • How many pounds must a sand bag weigh to test if a safety net can absorb the proper amount of force? A. 150 lbs. B. 200 lbs. C.
    6·1 answer
  • Several users on the second floor of your company's building are reporting that the network is down. you go to the second floor
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!