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
amid [387]
3 years ago
15

Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in

one of two lists—one list for short Strings that are 10 characters or fewer and another list for long Strings that are 11 characters or more. After data entry is complete, prompt the user to enter which type of String to display, and then output the correct list. For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings, output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered.
Computers and Technology
1 answer:
notsponge [240]3 years ago
3 0

Answer:

count = 20

i = 0

short_strings = []

long_strings = []

while(i<count):

   s = input("Enter a string: ")

   

   if s == "ZZZ":

       break

   

   if len(s) <= 10:

       short_strings.append(s)

   elif len(s) >= 11:

       long_strings.append(s)

   

   i += 1

choice = input("Enter the type of list to display [short/long] ")

if choice == "short":

   if len(short_strings) == 0:

       print("The list is empty.")

   else:

       print(short_strings)

else:

   if len(long_strings) == 0:

       print("The list is empty.")

   else:

       print(long_strings)

Explanation:

*The code is in Python.

Initialize the count, i, short_strings, and long_strings

Create a while loop that iterates 20 times.

Inside the loop:

Ask the user to enter a string. If the string is "ZZZ", stop the loop. If the length of the string is smaller than or equal to 10, add it to the short_strings. If the length of the string is greater than or equal to 11, add it to the long_strings. Increment the value of i by 1.

When the loop is done:

Ask the user to enter the list type to display.

If the user enters "short", print the short list. Otherwise, print the long_strings. Also, if the length of the  chosen string is equal to 0, print that the list is empty.

You might be interested in
What are 3 things that victims of cyber bullying can experience?​
Dennis_Churaev [7]

Answer: Isolation, Depression, Humiliation.

I hope this helps you out! ☺

3 0
2 years ago
Read 2 more answers
How can I identify what is and what isn't an IP Address?
adelina 88 [10]

Answer:

you can identify an ip address in the bar where u type links

Explanation:

7 0
2 years ago
PLEASE HELP ME ASAP!!! THIS IS DUE SOON!!
KengaRu [80]

The below displays ice-creams with its associated flavours. This we would display using <UL>

• Stick

o Chocobar

o Feast

• Bowl

o Butterscotch

o Blueberry

<UL>

 <LI>Stick

  <UL>

  <LI>Chocobar </LI>

  <LI> feast</LI>

  </UL>

 </LI>

<LI>Bowl

  <UL>

  <LI> Butterscotch </LI>

  <LI> Blueberry </LI>

  </UL>

 </LI>

</UL>

Here <UL> tag is used to create un ordered list and one another <UL> tag inside <LI> created nested list which is the actual requirement. Like this we can created nested unordered lists and you can nest upto 4 levels and increasing the number of levels further may reduce clarity.

3 0
2 years ago
How to connect on phpmyadmin?plss
Alex

Open your browser and go to localhost/PHPMyAdmin or click “Admin” in XAMPP UI. Now click Edit privileges and go to Change Admin password, type your password there and save it. Remember this password as it will be used to connect to your Database.

hope this helps!

5 0
2 years ago
An employee sets up an automation that transfers files in a specific folder on their PC to a remote drive for archiving, provide
Yuri [45]

Answer:

Rule based automation

Explanation:

8 0
2 years ago
Other questions:
  • In a video, a motionless image is called
    7·2 answers
  • If you think the user might enter 24.9, you should create a float variable. true or false
    9·1 answer
  • The following 2D array has been created:
    12·2 answers
  • Please help quickly!!! which of the following is not a peripheral?
    8·2 answers
  • Your boss is very skeptical about the idea of storing his files up in the cloud rather than on a local storage drive. He asks yo
    7·1 answer
  • Raul in Colombia can enter data into a spreadsheet. Olivia in England can access the spreadsheet a few minutes later and use Rau
    7·1 answer
  • Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes
    9·1 answer
  • Write a C program to calculate and display the coordinates of midpoint - M of a linesegment between two given points - say A and
    7·1 answer
  • _________ media must be downloaded in its entirety to the user's computer before it can be heard or seen
    5·1 answer
  • Consider a Huffman’s Algorithm that uses a variable-length encoding scheme to compress the original text: BIRTHDAY to determine
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!