Puzzle 3 – Linear Search Algorithm

Step 1 – titles and think of the number

These are so easy that I've combined them.

  1. start by adding the titles just like in your binary search algorithm using  print() statements
  2. then add  import random at the top – Python can't deal with random numbers without this
  3. then create the random number using  random.randint(1, 20). Store the value in a variable called  theNumber
  4. save your program as something like "simple linear search" and run it to check there aren't any errors

Don't forget to run the program.

If you want to see what number the program has generated, add a line that has  print (theNumber) at the end