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]
2 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]2 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
Extend the class linkedListType by adding the following operations: Write a function that returns the info of the kth element of
WINSTONCH [101]

Answer:

Explanation:

The following code is written in Java. Both functions traverse the linkedlist, until it reaches the desired index and either returns that value or deletes it. If no value is found the function terminates.

public int GetNth(int index)

       {

       Node current = head;

       int count = 0;

       while (current != null)

       {

       if (count == index)

       return current.data;

       count++;

       current = current.next;

       }

       assert (false);

       return 0;

       }

public int removeNth(int index)

       {

       Node current = head;

       int count = 0;

       while (current != null)

       {

       if (count == index)

       return current.remove;

       count++;

       current = current.next;

       }

       assert (false);

       return 0;

       }

6 0
3 years ago
Word processing software allows users to do which of the following: format text design pages share documents mail merge document
Sergio039 [100]
Well most word processing softwares allow you to do many things to a document, if you use google documents or microsoft word i'm pretty sure you can do all of those things
5 0
3 years ago
Read 2 more answers
The commands available here change depending on the activity taking place in the presentation window's main work area.
pickupchik [31]

task pane is correct!

7 0
3 years ago
Read 2 more answers
If an internet document identifies its author but says nothing about her or his qualifications, your textbook recommends that yo
PSYCHO15rus [73]

If the internet document identifies the author, the textbook recommends that you type the author's name into the internet search box.

<h3>What is an internet document?</h3>

These are those documents that are gotten from the a search on the internet. To cite such items there are certain guidelines that are to be followed.

A simple search on a search engine would show you the most important details that this author possesses.

Read more on internet documents here:

brainly.com/question/14715750

5 0
2 years ago
Gleick believes that the book is
ss7ja [257]

That it is a tool that does its job well, it's a technology that works.

6 0
3 years ago
Other questions:
  • A software program that enables users to find and display information stored as html pages on the internet is a(n) ____.
    5·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    7·1 answer
  • 1.
    13·1 answer
  • andy accidentally saved a file in the wrong folder. what is the quickest way to move the file? create a new file and save it in
    8·2 answers
  • The local emergency manager has the responsibility for coordinating emergency management programs and activities. A local emerge
    7·1 answer
  • Indexed sequential access, an index is more useful when the number of record is
    10·1 answer
  • A company uses the account code 669 for maintenance expense. However, one of the company's clerks often codes maintenance expens
    15·1 answer
  • Super easy question but you have to think about it because it’s not that easy I’ll mark brainliest for first answer Explain the
    11·1 answer
  • What is one way to recognize whether an online source has been copyrighted? The source features the phrase “all rights reserved.
    6·2 answers
  • Computer science - algorithms - flowcharts
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!