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

4.5 Code Practice

Computers and Technology
1 answer:
dmitriy555 [2]3 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
Given that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 months
SIZIF [17.4K]

Answer:

       System.out.println("October is the "+monthSales[9]+"th Month of the year");

A complete Java program is given in the explanation section.

Explanation:

public class num4 {

   public static void main(String[] args) {

   int [] monthSales = new int[12];

   int i=0;

   for(i = 0; i<monthSales.length; i++){

       monthSales[i] = i+1;

   }

       System.out.println("October is the "+monthSales[9]+"th Month of the year");

   }

}

In the code above, we created an an array of size 12 with this statement

int [] monthSales = new int[12];

using the for loop, the numbers 0-12 are added to the array corresponding to the twelve months in the year

The statement   System.out.println("October is the "+monthSales[9]+"th Month of the year"); outputs the corresponding number to October

5 0
3 years ago
How can website illustrate cooperations and kidness?
Brilliant_brown [7]
It can illustrate cooperation's and kindness by allowing many different people and strangers to post their opinions and thoughts as long as they are being positive about it! Hope i helped
8 0
3 years ago
Windows 8 uses a(n) ________ account for easy access and storage of online files.
Dafna1 [17]

Answer: OneDrive

Explanation: OneDrive

8 0
1 year ago
Software engineering design teams use ________, which are grounded in mathematical concepts of sets and relations, for their sof
zloy xaker [14]

Answer:

Relational Databases

Explanation:

These are digital databases that are made to recognize relations between previously stored items of info.

4 0
3 years ago
Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI).
dusya [7]

Explanation:

I have attached the answer as an image. I can't upload the file as it requires a licensed product and I only used demo version. I can provide the file too if you can give me your vlsig file required to use full software. However, If you just copy along the images on your Visual Studio, you will easily create the files yourself. Answer is provided for both scenarios as part A and part B, one which stops after 1 iteration and the one which loops until 0 height is given.

8 0
3 years ago
Other questions:
  • Failure to verify information can lead to?
    10·1 answer
  • Which device lets you hear audio on your computer?
    12·2 answers
  • How many computers/laptop's suported windows 10 pro with a game in vr?
    9·2 answers
  • (I'm sorry that this question isn't school related, I can't find answers anywhere else)
    8·1 answer
  • Some hardware can be added to the computer without having to restart or power down the computer. After a short period of time th
    5·1 answer
  • Write the definition of a class Counter containing: An instance variable named counter of type int. An instance variable named l
    14·1 answer
  • Which of the following is NOT a benefit of safety and health programs?
    11·1 answer
  • Instructions:Select the correct answer.
    8·2 answers
  • I still haven't figured out how to award someone branliest will someone help me? If you explain to me how to do it i will do awa
    14·1 answer
  • Instructions: Write a program that calculates the amount of ingredients needed for various flavors of cheesecake.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!