Question: PLEASE HELP ME FIX THIS CODE. IT DOES NOT SHOW THE LOCATION. Finds the locations of a target value in a list Use: locations =

PLEASE HELP ME FIX THIS CODE. IT DOES NOT SHOW THE LOCATION.

Finds the locations of a target value in a list Use: locations = find_value(num_list, target)

def find_value(num_list, target): locations = [] size = len(num_list) for index in range(size): if target == num_list[index]: locations.append(index)

return locations

num_list = get_string() print() print("{}".format(num_list)) target = int(input("Enter the desired target value: "))

locations = find_value(num_list, target)

print() print("The locations of the target value are: {}".format(locations))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!