Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Search
#2
First, you need to indent the code below the def statement. Currently it is not part of the function you are defining. Indenting is the way to show that it is part of the function you are defining.

Second, your parameters of target and list do not match the parameters specified in the problem.

Third, you are not doing anything N times. To do something N times, you use:

for times in range(N):
Finally, you can use the min and max functions to find the min and max of a list, and you will need to import the random module to generate random numbers.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Linear Search - by just_started_python - Nov-11-2016, 12:01 PM
RE: Linear Search - by ichabod801 - Nov-11-2016, 02:28 PM
RE: Linear Search - by heiner55 - Nov-17-2016, 12:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Linear search issue oli_action 5 2,499 Oct-13-2020, 10:02 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020