Explain why this algorithm works.

def binary_search(list, target):
  lower = 0 
  upper = len(list) - 1
    
  while lower <= upper: 
    mid = (lower + upper) // 2  # Floor Division
    guess = list[mid]
    if guess == target:
      return mid
    if guess > target:
      upper = mid - 1
    else: 
      lower = mid + 1
 
  return None
This algorithm works by using a divide and conquer approach. It begins by dividing the given list into two parts and finds a tuned position by repeatedly halving the list until the target element is found. This approach is advantageous because it greatly reduces the number of comparisons required to find the target value. If the element is not found, upper and lower bounds for the search become equal, meaning the element does not exist in the list. Hence, the algorithm is guaranteed to find the target (if it exists) or return None if it does not exist.