
def        __UpperCamelCase					(    lowerCAmelCase__							:    int = 1_0  ,       lowerCAmelCase__							:    int = 1_0_0_0  ,       lowerCAmelCase__							:    bool = True  ):
 assert (
     isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  )
     and isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  )
     and isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  )
 ), "Invalid type of value(s) specified to function!"

 if min_val > max_val:
  raise ValueError('''Invalid value for min_val or max_val (min_value < max_value)'''  )
 return min_val if option else max_val




def        __UpperCamelCase					(    lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    int  ):
 return int((number_a + number_a) / 2  )




def        __UpperCamelCase					(    lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    int  ):
 assert (
     isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  ) and isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  ) and isinstance(lowerCAmelCase__  ,       lowerCAmelCase__  )
 ), 'argument values must be type of "int"'

 if lower > higher:
  raise ValueError('''argument value for lower and higher must be(lower > higher)'''  )

 if not lower < to_guess < higher:
  raise ValueError(
      '''guess value must be within the range of lower and higher value'''  )

 def answer(lowerCAmelCase__							:    int  ) -> str:
  if number > to_guess:
   return "high"
  elif number < to_guess:
   return "low"
  else:
   return "same"

 print('''started...'''  )

 __a			:  int		    =  lower
 __a			:  Optional[Any]		    =  higher

 __a			:  str		    =  []

 while True:
  __a			:  Optional[Any]		    =  get_avg(lowerCAmelCase__  ,       lowerCAmelCase__  )
  last_numbers.append(lowerCAmelCase__  )

  if answer(lowerCAmelCase__  ) == "low":
   __a			:  int		    =  number
  elif answer(lowerCAmelCase__  ) == "high":
   __a			:  Optional[int]		    =  number
  else:
   break

 print(f"guess the number : {last_numbers[-1]}"  )
 print(f"details : {last_numbers!s}"  )




def        __UpperCamelCase					(    ):
 __a			:  Tuple		    =  int(input('''Enter lower value : '''  ).strip()  )
 __a			:  List[Any]		    =  int(input('''Enter high value : '''  ).strip()  )
 __a			:  Any		    =  int(input('''Enter value to guess : '''  ).strip()  )
 guess_the_number(lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )


if __name__ == "__main__":
      main()


from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
lowercase__          =10




def        __UpperCamelCase					(    lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    list[int]  ,       lowerCAmelCase__							:    int  ):
 for i in range(lowerCAmelCase__  ,       lowerCAmelCase__  ):
  if array[i] == target:
   return i
 return -1




def        __UpperCamelCase					(    lowerCAmelCase__							:    list[int]  ,       lowerCAmelCase__							:    int  ):
 __a			:  List[Any]		    =  0
 __a			:  Union[str, Any]		    =  len(lowerCAmelCase__  )
 while left <= right:
  if right - left < precision:
   return lin_search(lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )

  __a			:  str		    =  (left + right) // 3 + 1
  __a			:  List[Any]		    =  2 * (left + right) // 3 + 1

  if array[one_third] == target:
   return one_third
  elif array[two_third] == target:
   return two_third

  elif target < array[one_third]:
   __a			:  List[str]		    =  one_third - 1
  elif array[two_third] < target:
   __a			:  List[str]		    =  two_third + 1

  else:
   __a			:  Dict		    =  one_third + 1
   __a			:  Any		    =  two_third - 1
 else:
  return -1




def        __UpperCamelCase					(    lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    int  ,       lowerCAmelCase__							:    list[int]  ,       lowerCAmelCase__							:    int  ):
 if left < right:
  if right - left < precision:
   return lin_search(lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )
  __a			:  Union[str, Any]		    =  (left + right) // 3 + 1
  __a			:  Optional[Any]		    =  2 * (left + right) // 3 + 1

  if array[one_third] == target:
   return one_third
  elif array[two_third] == target:
   return two_third

  elif target < array[one_third]:
   return rec_ternary_search(lowerCAmelCase__  ,       one_third - 1  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )
  elif array[two_third] < target:
   return rec_ternary_search(two_third + 1  ,       lowerCAmelCase__  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )
  else:
   return rec_ternary_search(one_third + 1  ,       two_third - 1  ,       lowerCAmelCase__  ,       lowerCAmelCase__  )
 else:
  return -1


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      lowercase__          =input('Enter numbers separated by comma:\n').strip()
      lowercase__          =[int(item.strip()) for item in user_input.split(',')]
      assert collection == sorted(collection), F"List must be ordered.\n{collection}."
      lowercase__          =int(input('Enter the number to be found in the list:\n').strip())
      lowercase__          =ite_ternary_search(collection, target)
      lowercase__          =rec_ternary_search(0, len(collection) - 1, collection, target)
      if resulta != -1:
            print(F"""Iterative search: {target} found at positions: {resulta}""")
            print(F"""Recursive search: {target} found at positions: {resulta}""")
      else:
            print('Not found')
