

"""simple docstring"""


from __future__ import annotations



def   _A					(	_a	:						float     ,   _a	:						float     ,   _a	:						float				):



      """simple docstring"""






      if days_between_payments <= 0:
            raise ValueError("""days_between_payments must be > 0"""				)
      if daily_interest_rate < 0:
            raise ValueError("""daily_interest_rate must be >= 0"""				)
      if principal <= 0:
            raise ValueError("""principal must be > 0"""				)
      return principal * daily_interest_rate * days_between_payments



def   _A					(	_a	:						float     ,   _a	:						float     ,   _a	:						float     ,   ):



      """simple docstring"""






      if number_of_compounding_periods <= 0:
            raise ValueError("""number_of_compounding_periods must be > 0"""				)
      if nominal_annual_interest_rate_percentage < 0:
            raise ValueError("""nominal_annual_interest_rate_percentage must be >= 0"""				)
      if principal <= 0:
            raise ValueError("""principal must be > 0"""				)

      return principal * (
          (1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
          - 1
      )



def   _A					(	_a	:						float     ,   _a	:						float     ,   _a	:						float     ,   ):



      """simple docstring"""






      if number_of_years <= 0:
            raise ValueError("""number_of_years must be > 0"""				)
      if nominal_annual_percentage_rate < 0:
            raise ValueError("""nominal_annual_percentage_rate must be >= 0"""				)
      if principal <= 0:
            raise ValueError("""principal must be > 0"""				)

      return compound_interest(
          _a     ,   nominal_annual_percentage_rate / 3_6_5     ,   number_of_years * 3_6_5				)


if __name__ == "__main__":
  import doctest

  doctest.testmod()







"""simple docstring"""


def   _A					(	_a	:						Optional[int]     ,   _a	:						str				):



      """simple docstring"""






      A				  =		0
      A				  =		len(_a				) - 1

      while left <= right:
            # avoid divided by 0 during interpolation
            if sorted_collection[left] == sorted_collection[right]:
                  if sorted_collection[left] == item:
                        return left
                  else:
                        return None

            A				  =		left + ((item - sorted_collection[left]) * (right - left)) // (
                sorted_collection[right] - sorted_collection[left]
            )

            # out of range check
            if point < 0 or point >= len(_a				):
                  return None

            A				  =		sorted_collection[point]
            if current_item == item:
                  return point
            else:
                  if point < left:
                        A				  =		left
                        A				  =		point
                  elif point > right:
                        A				  =		right
                        A				  =		point
                  else:
                        if item < current_item:
                              A				  =		point - 1
                        else:
                              A				  =		point + 1
      return None



def   _A					(	_a	:						Any     ,   _a	:						List[str]     ,   _a	:						Dict     ,   _a	:						List[str]				):



      """simple docstring"""






      if sorted_collection[left] == sorted_collection[right]:
            if sorted_collection[left] == item:
                  return left
            else:
                  return None

      A				  =		left + ((item - sorted_collection[left]) * (right - left)) // (
          sorted_collection[right] - sorted_collection[left]
      )

      # out of range check
      if point < 0 or point >= len(_a				):
            return None

      if sorted_collection[point] == item:
            return point
      elif point < left:
            return interpolation_search_by_recursion(_a     ,   _a     ,   _a     ,   _a				)
      elif point > right:
            return interpolation_search_by_recursion(_a     ,   _a     ,   _a     ,   _a				)
      else:
            if sorted_collection[point] > item:
                  return interpolation_search_by_recursion(
                      _a     ,   _a     ,   _a     ,   point - 1				)
            else:
                  return interpolation_search_by_recursion(
                      _a     ,   _a     ,   point + 1     ,   _a				)



def   _A					(	_a	:						List[Any]				):



      """simple docstring"""






      if collection != sorted(_a				):
            raise ValueError("""Collection must be ascending sorted"""				)
      return True


if __name__ == "__main__":
  import sys
  UpperCAmelCase													=0
  if debug == 1:
    UpperCAmelCase													=[10, 30, 40, 45, 50, 66, 77, 93]
    try:
      __assert_sorted(collection)
    except ValueError:
      sys.exit("Sequence must be ascending sorted to apply interpolation search")
    UpperCAmelCase													=67

  UpperCAmelCase													=interpolation_search(collection, target)
  if result is not None:
    print(f"""{target} found at positions: {result}""")
  else:
    print("Not found")




