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]
4 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]4 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
As a student, why do you need to know and follow the steps printing a <br><br>document?​
Kazeer [188]
So I am able to print my math notes and keep up in geometry.
7 0
3 years ago
Read 2 more answers
Which of the following helps create a positive community?
Lera25 [3.4K]

Answer: D.) all of the above

Explanation: By doing all three of these it makes almost everyone in the community is happier and more positive which is better than the bully's & people who don't speak up feel less entitled, it achieves the goal.

5 0
3 years ago
A network interface port has collision detection and carrier sensing enabled on a shared twisted-pair network. From this stateme
hram777 [196]

Answer:

This is an Ethernet port operating at half duplex.

Explanation:

Modern Ethernet networks built with switches and full-duplex connections no longer utilize CSMA/CD. CSMA/CD is only used in obsolete shared media Ethernet (which uses repeater or hub).

7 0
3 years ago
Read 2 more answers
What is 01010101 converted to denary
Lisa [10]

Answer:

85

Explanation:

0 + 64 + 0 + 16 + 0 + 4 + 0 + 1 = 85

3 0
3 years ago
What is the difference between a doubly linked list and a singly linked list?
lina2011 [118]

Answer:

A doubly linked list links each element to both its predecessor and successor, whereas a singly linked list only points to its successor.

Explanation:

Doubly linked lists are easier to iterate backwards. With singly linked lists you'd have to start at the beginning every time.

7 0
4 years ago
Other questions:
  • Waterpower was first harvested by ancient societies using
    5·1 answer
  • How does montag know that the mechanical hound leaves faber's house alone?
    14·1 answer
  • Astrid's computer screen suddenly says that all files are now locked until money is transferred to a specific account, at which
    11·1 answer
  • Which of the following describes the pre-phase of an interview
    7·1 answer
  • What is a task that is not associated with loading existing data into a new ERP system.
    11·2 answers
  • Write the code for the following problem.
    9·1 answer
  • 37) Which of the following statements is true
    14·1 answer
  • Multiple Choice: Circle the letter that corresponds to the correct answer.
    12·1 answer
  • PLEASE PLEASE PLEASE PLEASE help me Im completly lost will give brainliest and 50 points
    8·2 answers
  • I need someone to help me paraphrase and make it in there own words? I struggle with this. This is the sentence
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!