4.5 Code Practice


Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in this format:

#1: You entered _____
When STOP is entered, the total number of words entered should be printed in this format:

All done. __ words entered.

Sample Run
Please enter the next word: cat
#1: You entered cat
Please enter the next word: iguana
#2: You entered iguana
Please enter the next word: zebra
#3: You entered zebra
Please enter the next word: dolphin
#4: You entered dolphin
Please enter the next word: STOP
All done. 4 words entered.

Answers

Answer 1

In python 3:

i = 0

while True:

   word = input("Please enter the next word: ")

   if word == "STOP":

       break

   i += 1

   print("#{}: You entered {}".format(i, word))

print("All done. {} word(s) entered.".format(i))

I hope this helps!

Answer 2

The program is an illustration of loops.

Loops are used to perform repetitive operations.

The program in Python, where comments are used to explain each line is as follows:

#This gets input for the first word

word = input("Please enter the next word: ")

#This initializes count to 0

count = 0

#The following iteration is repeated until the user enters "STOP"

while word != "STOP":

   #This prints the word entered

   print("You entered",word)

   #This increments count by 1

   count += 1

   #This gets input for the next words

   word = input("Please enter the next word: ")

   

   

#This prints the count of all words

print("All",count,"words entered!")

At the end of the program, the number of valid inputs is printed.

Read more about similar programs at:

https://brainly.com/question/18283451


Related Questions

How to use modulo operator in Java

Answers

To use modulo in Java, you have to use the percent symbol %.

For instance,

int x = 2;

int y = 2;

System.out.println(x%y) will print 0 to the screen.

Tim is trying to explain to his aunt how her computer works, but she does not understand what a CPU does. Which description will most likely help Tim’s aunt understand the CPU’s role?

Answers

Answer:

CPU is considered as the brain of the computer. CPU performs all types of data processing operations. It stores data, intermediate results, and instructions (program). It controls the operation of all parts of the computer.

Explanation:

Answer:

The CPU processes commands from software.

Explanation:

Learned on edge

How do you activate the Slicer Tools contextual tab?
Select a PivotTable and it will appear.
Select a slicer and it will appear.
Click Slicer and then Options.
It is found under the PivotTable commands.

Answers

Answer:

Select a slicer and it will appear.

Explanation:

i did it

You can activate the Slicer Tools contextual tab by selecting a slicer and it will appear. Thus, the correct option for this question is B.

What do you mean by the Slicer tool?

The Slicer tool may be characterized as a type of tool that significantly provides buttons that you can click to filter tables or PivotTables. In addition to quick filtering, slicers also indicate the current filtering state, which makes it easy to understand what exactly is currently displayed.

According to the context of this question, if you want to use the slicer tool in excel, select Insert > Slicer. After selecting a slicer it will automatically appear on the computer screen followed by selecting the fields you'd like to filter.

Therefore, you can activate the Slicer Tools contextual tab by selecting a slicer and it will appear. Thus, the correct option for this question is B.

To learn more about Slicer tools, refer to the link:

https://brainly.com/question/19717692

#SPJ5



6) Sometimes it is difficult to read a piece of code and understand what the code will do. For this reason, you may want to add notes to yourself (or to someone else that may read the code) that show up in the code, but not when you run the program. What are these notes called and what symbol do you use to write them

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The notes that are used in a piece of code to understand the difficulty of coding or for others to read it is called comments.

Comments in code help in understanding the code, they help others to read the code and understand the logic written behind it. Comments also help the programmer to read his code himself for understanding purposes. Comments in coding used for understanding the purpose of code and what the code will do. The comments written in the program cannot execute or shown when you run the program.

Comments in coding/program can be used in two ways in almost all programming languages. You can use comments on a single line and in multiple lines.

To show a comment on a single line, you can use the double backslash "//" .

To make a comment on a single line. for example

//here the calculation start or some other understandable comments.

if the comments are more than one line then you can use "/*    */" symbols to write comments on multiple lines

for example:

/* this is the code

that calculate the sum and average of students grades

it also displays the grade in letter

*/

Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score (display the student's name and score). Also calculate the average score and indicate by how much the highest score differs from the average. Use a while loop.

Answers

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int n,s=0,j,number,h=-1;//defining integer variables

string name, nh;//defining string variable

float avg;//defining float variable

cout<<"Enter the number of students: ";//print message

cin>>n;//input value in n

while (j< n) //defining loop for input value

{

getline(cin, name);//use getline method to input value

cout<<"Enter the student name: ";//print message

getline(cin, name);//use getline method to input value

cout<<"Enter the score: ";//print message

cin>>number;//input number value

s+= number;//add numbers into s variable

if(h<number)//defining if block that checks h is greater then number

{

nh= name;//use string variable nh to store name value

h= number;//use integer variable h to store name value

}

j++;//increment j value by 1

}

cout<<name<<endl;//print highest name value

cout<<"score: "<<h<<endl;//print highest score value

avg = (float)s/(float)n;//calculate the average value

cout<<"Average is: "<<avg<<endl;//print average value

cout<<"Difference: "<<(h-avg)<<endl;//print average difference

return 0;

}

Output:

please find attached file.

Explanation:

In the above code, inside the main method four integer variable "n,s,j, number, and h", two string variable "name and nh" and one float variable "avg" is defined.

In the next step, n is defined that is used for the input value. and Inside the main method, a while loop is defined, which uses the "getline" method to the input value, and use s variable to add all numbers.

In the next step, if a block is defined that checks "h" is greater than the number value if the condition is true, it will print the highest value of the input variable and its average difference.

A folder is one icon considered a short cut true or false

Answers

Answer:

True

Explanation:

A shortcut can be an icon that points to a certain app or website.

The toolbox was a feature of the Mac OS that____?

GUYS I NEED HELP ASAP

a) made it Incredibly stable
b) Allowed Users to locate The Important Files
c) ensured Applications Would Have A Constant Look And Feel
d) Allowed User To Access Icons

Answers

Answer:

I think its c

Explanation:

Because launch pad is B and D and A does nothing to that

In Python, arrays are usually reserved for
sorting operations.
indexing operations.
searching operations.
numerical operations.

Answers

Answer:

D on Edge, or Numerical Operations

Explanation:

In Python, arrays are usually reserved for numerical operations, such as sorting numbers from lowest to highest.

Answer:

D

Explanation:

How is computer programming useful in real life? Help me

Answers

It can help you with technology and can help you become a computer programmer if you like technology hope this works I’m sorry if it doesn’t

Electronic medical charts make it easier for doctors to

share information on patients with other doctors.
share information on patients with the government.
communicate with patients about medical issues.
track infectious diseases through a database.

Answers

Answer:

Share information on patients with other doctors

Explanation:

Got it right on edge test

Answer:

Share information on patients with other doctors

Explanation:

In a non-linear control structure, the statements are executed depending upon the

Answers

Answer:

test condition

Explanation:

What is Hypertext Transfer Protocol?

Answers

Answer:

an application layer protocol for distributed, collaborative, hypermedia information systems.

Explanation:

I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
Use this option to view your presentation as your audience will see it.

File menu
Play button
Slide Show button
Tools menu

Answers

Answer:

slide show button give me plz

Explanation:

In a business environment, in which situation would email be more appropriate for communicating than texting?
А
Sending a message to your supervisor for not able to attend social gathering
00
Sending a contract to your supervisor for her review and advice
C с
Sending a message to a friend about meeting at the ballgame later that evening
D
Sending a message to a co-worker about a special delivery at the front desk

Answers

Answer:

The answer to this question would be the second one.

Explanation:

The reason for this is because all of the other answers are not as work-related as the second one.

4.9 question 2 edhesive
Anyone know how to do this???

Answers

I've included my code in a picture. I hope this helps!

Answer:

sum = 0

for x in range (20, 91, 10):

   sum= sum + x

   print(sum)

 

Explanation:

In a paragraph of 125 words, describe the benefits of having an electronic résumé.

Answers

Answer:

Employers benefit from the advantages online resumes offer, including having access to a host of possible applicants based on specific search criteria and limiting their search to applications that possess the exact skills and qualities they are looking for.

Answer:

There are numerous advantages to creating an online resume. Companies themselves are increasing their use of online services because they offer significant cost savings over traditional hiring methods. As such, many industries and government organizations will now specifically ask job seekers to post their resumes online in a specific format (e.g., MS Word, HTML, or PDF), either by uploading them from another location or recreating them on their website.

     However, the main advantage of online resumes is that they are instant; sending a resume through the mail is likely to take days, and if a company needs to hire someone fast, or are looking for temporary or freelance work, they're unlikely to go to the trouble to post an advertisement, wait for resumes to arrive, and then sort through them.

     Companies will instead be looking for a speedy solution, and having an online resume immediately opens up these avenues to you.

     Keeping your resume online also allows you to instantly update your resume with your most recent achievements, even notifying potential employers of this update if they are considering your resume.

Explanation:

Which of the following are examples of formal education? Check all of the boxes that apply. attending a college course at an accredited college attending a continuing education course reading a nonfiction book following a blog of an expert in the field​

Answers

the answers are:

- attending a college course at an accredited college

- attending a continuing education course

Examples of formal education will be attending a college course at an accredited college and attending a continuing education course.

What is formal education?

Formal education is the organized educational concept that integrates specialized training for occupational, academic, and formal development and goes from elementary (and in some countries, from nursery) school through university.

Features of formal education are given below.

The organization of formal schooling is pyramidal.It is purposeful and well-planned.Planned fees are consistently paid.Its grading scale is based on time.It is curriculum-driven and subject-focused. The syllabus has to be covered within a specific time period.The professors instruct the youngster.

Studying a degree course at an approved university or taking an ongoing education course are forms of formal education.

More about the formal education link is given below.

https://brainly.com/question/16642972

#SPJ2

If the grade is 60, which action will be executed?

Answers

Answer:

Study with tutor

Explanation:

Edgenuity

Why can't you test a program for run-time errors when it has compile-time (syntax) errors

Answers

Answer:

your computer will not allow it

Explanation:

because it is not one of the main dyonostics

Which of the following are safety rules when using household chemicals?
A. Never mix household products together B. Keep chemicals in their original bottles C. Turn on a fan or open windows when using household chemicals. D. All of the above

Answers

Answer:

D. All of the above.

Explanation:

Answer:

all of the above

Explanation:

js took the test


You can enter more than one element of data in the same field. *

True
False

Answers

Answer:

true

Explanation:

im smart

Which of these would a computer scientist study, in addition to computers?
graphics
biology
math
grammar

Answers

Answer:

Its either math or biology but probably math.

Answer:

likely math (edge)

Explanation:

A computer scientist isn’t exactly the one you might be thinking of. They don’t study biology or chemicals. They study computers.

In programming, you need to know math to code many things, like math operators, or like writing an equation for programming how fast your game character moves/jumps or how projectiles shoot from a weapon. Pretty pog.

It could be graphics but I bet on math.

I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
Use this option to view your presentation as your audience will see it.

File menu
Play button
Slide Show button
Tools menu

Answers

You would need to use the slide show button.

Answer:

It's either slide show button or the play button

Explanation:

what is keyboard?example of computer?

Answers

Answer:

1.Keyboard is a panel of keys that operate a computer or typewriter.

2.Ada Lovelace and MacBook

What is a Keyboard?

An Keyboard is an input Device used to enter characters and functions into the computer system by pressing buttons.

If you can’t see the Assets panel, which of these three buttons do you press?

A) Plugins
B) Assets
c) Layers

Answers

Answer: B

Explanation:

The answer is B


Explanation

I did it

What will be the output of the following program? Assume the user responds with a 3.

answer = input ("How many shirts would you like? ")
priceShirt = 4.00
intNumberShirt = float(answer)
moneyDue = intNumberShirt * priceShirt
print ("You owe $" + str(moneyDue))

You owe $ 12.0

An error occurs.

You owe $12.0

You owe $ moneyDue

Answers

If the user responds with 3, the output will be:

You owe $12.0

Answer:

You owe $12.0

Explanation:

Which selling method is most likely to irritate potential customers? A. Running a trade fair booth B. Cold calling C. Running a flea market booth D. Telemarketing to people who are interested in the product. ​

Answers

Answer:

B

Explanation:

Answer:    B.   Cold Calling

Explanation:

In business, cold calling means to contact people who haven't actually proved to be interested in their products/services. A salesperson may try cold calling to try and convince the person to be. This may be irritating to potential customers because instead of finding it out for themselves, the salesperson is shoving information down their throats.

I hope this helped!

Good luck <3

Computers that are connected to each other, but not to the internet,
configured according to which network?
plzz this due today

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Computers that are connected to each other, but not to each other - is an intranet.

Because in intranet computers are connected to each other within an organization and don't connect to the internet. In the intranet, computers don't access globally. For example, in banking, the banking system can be accessed within the organization but not from outside as on the internet.

While it is noted that the Internet is a globally-connected network of computers that enables people to share information and communicate with each other. An intranet, on the other hand, is a local or restricted network that enables people to store, organize, and share information within an organization.

Binary numbers to their Decimal equivalents – (11101100)2= (?)10

Hexadecimal numbers to their Decimal equivalents – (3AD)16= (?)10

Help Vaibhav to express the decimal number 2358 as an Octal number.


solve this asap and ill mark you brainliest

Answers

Answer:

q.no.1

ans=236

q.no.2

ans=914

Answer:

1.236

2.241

3.4466

Explanation:

It is very easy .I have a method

compare the computer with human beings on the basis of its features​

Answers

Answer:

CPU=Brain MotherBoard=Heart

Explanation: The CPU does process just like the brain and the motherboard allows everything to function by getting power from your power supply similar to the human heart

Other Questions
Emic and etic are referred to asA. HomonymsB. Types of material cultureC. PerspectivesD. Populations please please help me!! 2. Do you consider action painting, color field painting, and pictographic painting true art? Please answer will mark brainliest what is a mathmatical expression? give an example What is the least common denominator of 1/14, 3/16, 2/15 What are the notes used in the song?In hickory dickory dock the needs of paying school fees to the school Please help me this is due tomorrow and I just need this. ALSO WHEN YOU ANSWER SHOW ME YOUR STEPS FOR BRAINLEST THANKS! When does carbon dioxide absorb the most heat energy?during freezingduring depositionduring sublimationduring condensation Which is the best descripion of figurative language? ORexpresses an emotion or feeling O t shows the achral meaning of samething Ot showS what something looks like O texpresses the writer's opinion 3. Why do you think fire was so important to Greek people? Robin has read 3/4 of a book. Mark said he had read 1/2 as much as Robin. What fraction of the book has mark read. Which form of energy is used as a roller coaster moves down the track?a roller coaster moving down a track Chemical energy Light energy Mechanical energy Solar energy searching online for airline tickets. Two weeks ago, the cost to fly from to was $210. Now the cost is $355. What is the percent increase? What would be the percent increase if the airline charges an additional $50 baggage fee with the new ticket price? -5 5/8 5A) -1 1/8B) -5/8C) 5/8D) 1 1/8 What is 8.51736 rounded to the nearest ten-thousandth? 4p+2q=628pq=59Multiply 4p+2q=62 by 2, then subtract 8pq=59 from the result.Multiply 8pq=59 by 2, then add the result to 4p+2q=62.Do both strategies work for solving the system? If so why? PLEASE HELP WILL GIVE BRAINLIEST FACTOR THE EXPRESSION 100 - 80 USING THE GCF