
"""simple docstring"""




from __future__ import annotations

import bisect




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase = 0 ,				_UpperCamelCase = -1						):






  """simple docstring"""



  if hi < 0:
    _lowercase:			Tuple       =     len(_UpperCamelCase						)

  while lo < hi:
    _lowercase:			List[str]       =     lo + (hi - lo) // 2
    if sorted_collection[mid] < item:
      _lowercase:			str       =     mid + 1
    else:
      _lowercase:			List[Any]       =     mid

  return lo




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase = 0 ,				_UpperCamelCase = -1						):






  """simple docstring"""



  if hi < 0:
    _lowercase:			Optional[Any]       =     len(_UpperCamelCase						)

  while lo < hi:
    _lowercase:			Any       =     lo + (hi - lo) // 2
    if sorted_collection[mid] <= item:
      _lowercase:			str       =     mid + 1
    else:
      _lowercase:			List[str]       =     mid

  return lo




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase = 0 ,				_UpperCamelCase = -1						):






  """simple docstring"""



  sorted_collection.insert(bisect_left(_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						) ,				_UpperCamelCase						)




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase = 0 ,				_UpperCamelCase = -1						):






  """simple docstring"""



  sorted_collection.insert(bisect_right(_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						) ,				_UpperCamelCase						)




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			int       =     0
  _lowercase:			Optional[int]       =     len(_UpperCamelCase						) - 1

  while left <= right:
    _lowercase:			Tuple       =     left + (right - left) // 2
    _lowercase:			Union[str, Any]       =     sorted_collection[midpoint]
    if current_item == item:
      return midpoint
    elif item < current_item:
      _lowercase:			str       =     midpoint - 1
    else:
      _lowercase:			List[str]       =     midpoint + 1
  return None




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			int       =     bisect.bisect_left(_UpperCamelCase ,				_UpperCamelCase						)
  if index != len(_UpperCamelCase						) and sorted_collection[index] == item:
    return index
  return None




def   _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  if right < left:
    return None

  _lowercase:			int       =     left + (right - left) // 2

  if sorted_collection[midpoint] == item:
    return midpoint
  elif sorted_collection[midpoint] > item:
    return binary_search_by_recursion(_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				midpoint - 1						)
  else:
    return binary_search_by_recursion(_UpperCamelCase ,				_UpperCamelCase ,				midpoint + 1 ,				_UpperCamelCase						)


if __name__ == "__main__":
  A__   :					Tuple							=   input('Enter numbers separated by comma:\n').strip()
  A__   :					Optional[int]							=   sorted(int(item) for item in user_input.split(','))
  A__   :					str							=   int(input('Enter a single number to be found in the list:\n'))
  A__   :					Optional[int]							=   binary_search(collection, target)
  if result is None:
    print(f"""{target} was not found in {collection}.""")
  else:
    print(f"""{target} was found at position {result} in {collection}.""")


"""simple docstring"""




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  if not isinstance(_UpperCamelCase ,				_UpperCamelCase						):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''						)
  if len(_UpperCamelCase						) == 0:
    raise ValueError('''Input list must be a non empty list'''						)
  if len(_UpperCamelCase						) == 1:
    return True
  _lowercase:			Any       =     series[1] - series[0]
  for index in range(len(_UpperCamelCase						) - 1						):
    if series[index + 1] - series[index] != common_diff:
      return False
  return True




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  if not isinstance(_UpperCamelCase ,				_UpperCamelCase						):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''						)
  if len(_UpperCamelCase						) == 0:
    raise ValueError('''Input list must be a non empty list'''						)
  _lowercase:			Tuple       =     0
  for val in series:
    answer += val
  return answer / len(_UpperCamelCase						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
