“Searching Tree” is a series of Python tutorials that teach you how to make a number searching algorithm that I made. I’m using Python because it’s popular and efficient.

What is binary search?

Binary search is a searching algorithm. It works by taking a number(say, 100) and splitting it in half over and over again until it gets to the correct number.

How to make it

Step 1: define the variables

You need three variables: currnum(so the computer knows what number it’s dealing with), correct(so the computer knows if it’s correct), and inputs(so the user can input if the number is correct or not). Your code should look like this:

#We are dealing with 50 first
currnum = 50
#We haven’t checked yet, so it’s false
correct = False
#We need an input and it needs to be lowercase
inputs = input(“Pick any number between 1 and 100.\nIs it more or less or equal to 50?\n”).lower()

Step 2: make the loop

Now we need to make the loop that loops until the number is correct. So it should look like this:

#We are dealing with 50 first
currnum = 50
#We haven’t checked yet, so it’s false
correct = False
#We need an input and it needs to be lowercase
inputs = input(“Pick any number between 1 and 100.\nIs it more or less or equal to 50?\n”).lower()
#The loop iterates until the number is correct
while correct == False:
#...

Step 3: add the if

Now, we will add the if loop that checks if it’s correct. It should check for equal, less, and more.

#We are dealing with 50 first
currnum = 50
#We haven’t checked yet, so it’s false
correct = False
#We need an input and it needs to be lowercase
inputs = input(“Pick any number between 1 and 100.\nIs it more or less or equal to 50?\n”).lower()
#The loop iterates until the number is correct
while correct == False:
if inputs == “equal”:
#...
elif input == “less”:
#...
elif input == “more:
#...

Step 3: finishing touches

Now it should look like this:

#We are dealing with 50 first
currnum = 50
#We haven’t checked yet, so it’s false
correct = False
#We need an input and it needs to be lowercase
inputs = input(“Pick any number between 1 and 100.\nIs it more or less or equal to 50?\n”).lower()
#The loop iterates until the number is correct
while correct == False:
if inputs == “equal”:
print(”Yay! I guessed it!”)
correct = True
elif input == “less”:
correct /= 2
inputs = input(“Is it more or less or equal to” + str(correct) + “?\n”)
elif input == “more:
correct /= 2
correct += correct
inputs = input(“Is it more or less or equal to” + str(correct) + “?\n”)

## What is “Searching Tree”?

“Searching Tree” is a series of Python tutorials that teach you how to make a number searching algorithm that I made. I’m using Python because it’s popular and efficient.

## What is binary search?

Binary search is a searching algorithm. It works by taking a number(say, 100) and splitting it in half over and over again until it gets to the correct number.

## How to make it

## Step 1: define the variables

You need three variables:

`currnum`

(so the computer knows what number it’s dealing with),`correct`

(so the computer knows if it’s correct), and`inputs`

(so the user can input if the number is correct or not). Your code should look like this:## Step 2: make the loop

Now we need to make the loop that loops until the number is correct. So it should look like this:

## Step 3: add the if

Now, we will add the if loop that checks if it’s correct. It should check for equal, less, and more.

## Step 3: finishing touches

Now it should look like this:

Sorry if I didn’t explain well, I’m in a rush.

Not possible. I mean, checking back is possible, but not rushing? Not happening, especially for a long tutorial. @Highwayman