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
gizmo_the_mogwai [7]
3 years ago
11

g Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should NO

T be added to the list). These values entered by the user are added to a list we call 'initial_list'. Then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. Finally, inside main(), print out all of the values in the new list. For example: Input: Enter value to be added to list: a Enter value to be added to list: b Enter value to be added to list: c Enter value to be added to list: exit Output: a b c a b c a b c Note how 'exit' is NOT added to the list. Also, your program needs to be able to handle any variation of 'exit' such as 'Exit', 'EXIT' etc. and treat them all as 'exit'.
Computers and Technology
1 answer:
elena-14-01-66 [18.8K]3 years ago
4 0

Answer:

Following are the code to the given question:

def list_function(initial_list):#defining a method list_function that takes list in parameter

   l = initial_list*3#defining l that multiple the list by 3

   return l#return list  

def main(): #defining main method    

   initial_list = []#defining an empty list

   while True:#defining while loop

       i = input("Enter value to be added to list: ")#defining i variable that input list value

       i = i.rstrip()#use rstrip method

       if i.lower() == "exit" and "EXIT" and "Exit":#defining if block that checks list value is in lower case  

           break#use break keyword

       initial_list.append(i)#use list that adds input value

       l = list_function(initial_list)#defining l variable that calls the list_function method

   for i in l:#defining for loop that print list items

       print(i)#print value

main()

Output:

Please find the attached file.

Explanation:

In this code, a method "list_function" is declared that takes list "initial_list" in parameter and defines "l" variable that multiple the list by 3 and return its list value.

In the main method an empty list "initial_list" is declared that defines a while loop that input list value and use rstrip method and define and if block that checks list value is in lower case and pass into the method and use for loop to prints its values.

You might be interested in
The Work Queue "Customer Onboarding" has a number of Pending Items which may be tagged as
BlackZzzverrR [31]

Answer:

The Correct Answer is C. Configure "Domestic + [Product Code] <> LN*" in the Tag Filter parameter

Explanation:

First, I'll split the answer into bits

Domestic -> This shows that the product belongs to a Domestic Customer

[Product Code] -> The tag [] shows that the Product Code is a generated variable that is unique to different products

<> This means Not Equal to

LN* -> Loan Product

So, [Product Code] <> LN* means Product Code is not Equal to Loan Product

Bring the whole tag together,

It means

Product Codes that belongs to domestic customer which is not Equal to Loan products

3 0
3 years ago
he blinking vertical line that indicates where your text will appear when you type is called the ____.
Lapatulllka [165]

Answer:

Insertion point

Explanation:

in software applications that require text input, the insertion point shows where the next text will be inserted, it appears as a blinking vertical line and can be moved by the use of arrow keys or mouse click on the desired location you want it to move to, while  cursor on the other hand indicates where on the screen the user can send a command.

7 0
3 years ago
How to make the heart symbol in photoshop
sveta [45]
Click the font drop-down box in the tool settings bar. Select "Arial." 6. Press "Alt-3" using your keyboard number pad's "3" key to insert the heart symbol<span>.</span>
3 0
4 years ago
Read 2 more answers
Which of the following statements is true of San serif fonts?
Vsevolod [243]
They are easier to read on a computer screen
7 0
3 years ago
Read 2 more answers
Need help with this is photography :)
mestny [16]

Answer:

UV filter, This filter blocks UV light and removes the blue cast from images taken in very bright sunny conditions. ... With old film cameras it was often necessary to use a UV filter because film is extremely sensitive to UV light.

8 0
3 years ago
Other questions:
  • What are some ways social media networks make money from users
    10·1 answer
  • What might happen if a computer has too many applications running at one time?
    15·1 answer
  • While reading his favorite outdoor sports magazine, Jeff sees an advertisement for a new camping tent that is designed for quick
    12·2 answers
  • Alicia would like to make important text in her spreadsheet stand out. Alicia should _____
    8·2 answers
  • Which payment method typically charge is the highest interest rates?
    12·1 answer
  • Please Help
    12·2 answers
  • 1. Write the syntax of the following HTML commands by using any one attribute
    6·2 answers
  • What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:
    15·1 answer
  • What's the answer plssss​
    10·1 answer
  • Identify suitable hardware components that will meet your requirements. Be reasonably specific. For example:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!