> Python homework help?

Python homework help?

Posted at: 2014-12-18 
It's hard to tell for sure without indentation, which is important in Python

You could call it LocateTarget ().

It gives a list of all the indexes of all the targets in theList. In your example, it finds the location of all the 4's in the list.

Did you try to run it yourself to see what it does?

def AlgorithmName (target, thelist):

location = []

for pos in range(0, len(thelist)):

if thelist[pos] == target:

location.append(pos)

return location

theList=[0,1,3,-2,4,5,6,7,9,8,4,3,4,2,3,1,99,99,99]

target = 4

location = AlgorithmName (target,theList)

print(location)

*****

What would this Algorithm be called and what would it do?