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

Find the number of times a value appears in a list, and create a new list that contains the index positions where the value occu

rs in the list argument.
Computers and Technology
1 answer:
Maru [420]3 years ago
3 0

Answer:

Program :

list_1=[]#take the empty list.

size=int(input("Enter the size of the list: "))#take the size of the list from the user

for x in range(size): #for loop which insert the elemnt on the list.

   list_1.append(int(input("Enter the "+str(x+1)+" element of the list: ")))#take the user input and insert the element.

element=int(input("Enter the element to be searched: "))#it take the elemnt to search.

loc=1#intialize the location value.

count=0

for x in list_1:#for loop to check the element.

   if(x==element): #check the element.

       print(loc,end=", ")#print the location of the element.

       count=count+1

   loc=loc+1

if(count==0):

   print("The element is not present on the list")#print when elemnt are not present.

Output:

  • If the user input 5 for the size and 1,2,3,4,5 for the list and 5 for the element, then it will print 5.

Explanation:

  • The above code is in python language which is used to take the size for the list, then take the value to add on the list.
  • Then the element is entered from the user to search on the list.
  • Then the element is searched on the list with the help of for loop.
  • It prints the location when the element is matched.

You might be interested in
What is one advantage of hard-disk recording?
NemiM [27]

Answer:

It allows for Non-linear editing

7 0
3 years ago
In the story, what are the song pauses a metaphor for?
-BARSIC- [3]

Answer:

D. The need to slow down more often in life.

4 0
3 years ago
3. In which of the following places can
maw [93]

Answer:

On the World Wide Web

Explanation:

Sure theres always a homepage somewhere. But i dont know what your researching so i went with c.

8 0
3 years ago
Read 2 more answers
Demographics and psychographics influence database marketing.<br><br><br> False<br><br> True
Kamila [148]

Answer:

true is the correct answer

5 0
3 years ago
What is the difference between paper size and page margins in word
yKpoI14uk [10]
Paper size is how big or small the paper is whilst paper margin is the staight lines or shapes at the sides of a page or sheet.
6 0
3 years ago
Read 2 more answers
Other questions:
  • The ___ is the primary storage device of a personal computer. hard drive RAM ROM compact disc
    6·1 answer
  • Why is timbre an important musical element?
    7·2 answers
  • I can create spreadsheets in Google Draw. False True
    14·2 answers
  • _____ refers to unsolicited commercial emails, usually sent to a large number of people with little regard to the users interest
    14·1 answer
  • Among the eight unique features of​ e-commerce, which is related to the ability to interact with web technology​ everywhere?
    14·1 answer
  • Some websites are dedicated to cataloguing information. Since these sites contain so much data, these sites are usually organize
    11·2 answers
  • Which of the following is true for an API?
    6·1 answer
  • What is the function for displaying differences between two or more scenarios side by side?
    11·2 answers
  • -(-13) P binary using signed. 2's complement representation
    11·1 answer
  • 3) The director tells you to truck left, you must:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!