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
hram777 [196]
2 years ago
6

4.5 Code Practice

Computers and Technology
1 answer:
dmitriy555 [2]2 years ago
7 0

i = 0

while True:

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

   if user_input == "STOP":

       break

   i += 1

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

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

First we set i equal to zero so that we can keep track of how many words we input.

We set while True so that its a continuous loop until a certain condition is met to break out of the loop.

user_input is set equal to whatever word the user enters.

our if statement tells us to break out of the while loop if the user inputs "STOP"

If the user does not enter STOP i is set equal to itself plus 1. This just means we add one to i for every new word entered.

Then we print whichever word is entered.

After the while loop, we print All done and the quantity of words entered.  

You might be interested in
There are 22 gloves in a drawer: 5 pairs of red gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the da
AVprozaik [17]

Answer:

Best-case = 2 gloves

Worst-case = 12 gloves

Explanation:

  • For the best-case: Because there is a chance that you take two gloves of the same color in the first two round the answer is two.
  • For the worst-case: The worst case would be if, for each color-group of gloves you take the right or left glove, for example, you take 5 left-hand red gloves then 4 left-hand yellow gloves, then 2 left-hand green gloves, because you have already taken all of the left gloves the next one is going to be a right glove that is going to pair with one of the already selected gloves, therefore, the answer is 12 -> 5+4+2+1 = 12
3 0
2 years ago
Files and e-mail messages sent over the Internet are broken down into smaller pieces called _____.
Fynjy0 [20]
Files and email messages sent over the internet are broken down into smaller pieces called packets
6 0
3 years ago
Which mitigation technique would prevent rogue servers from providing false ip configuration parameters to clients?
IrinaVladis [17]
DHCP snooping is a mitigation technique<span> to </span>prevent rogue<span> DHCP </span>servers  <span>from </span>providing false IP configuration parameters to clients.  DHCP snooping<span> is a security feature that acts like a firewall between untrusted hosts and trusted </span>DHCP<span> servers. It is</span><span> a series of techniques applied to improve the security of a </span>DHCP<span> infrastructure. </span>
6 0
3 years ago
Read 2 more answers
Why doesnt brainly let me skip by watching video?
oksian1 [2.3K]

What do you want to skip in brainly? There isn't anything to skip that I can think of.

4 0
3 years ago
The part of a computer that provides access to the internet
guapka [62]

Answer:

Modem

Explanation:

A modem is a device that converts your data into a relevant format so that it can be used in the transmitting process from one computer to another one.

3 0
2 years ago
Other questions:
  • What is special about the f and j keys on a standard keyboard?
    15·2 answers
  • Types of operating systems
    5·2 answers
  • Select
    14·1 answer
  • Blood Alcohol Level (BAL) is the ratio between the alcohol consumed and the blood in the body. A. True B. False
    12·2 answers
  • A label control may be added to a form by double-clicking on the Label control icon in the ________ window.
    15·1 answer
  • What is the value of numX when this program is executed? if 3 &lt; 5 and 8 != 3: numX = 3 else: numX = 7
    13·2 answers
  • Write a function (subroutine) that inputs a data value in register r0 and returns value in r0. The function returns y 5 a 1 bx 1
    15·1 answer
  • Which of the following statements tests if users walked 10,000 or more steps and ate fewer than 25 grams of sugar?
    9·1 answer
  • What free website can you record videos on, and edit them without money?
    5·2 answers
  • The final step in the object-oriented design (ood) process consists of developing the?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!