

"""simple docstring"""






def 	lowercase      (   __UpperCamelCase						) ->      bool:
 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
 __magic_name__     =      series[1] - series[0]
 for index in range(len(__UpperCamelCase						) - 1						):
  if series[index + 1] - series[index] != common_diff:
   return False
 return True





def 	lowercase      (   __UpperCamelCase						) ->      float:
 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'''						)
 __magic_name__     =      0
 for val in series:
  answer += val
 return answer / len(__UpperCamelCase						)


if __name__ == "__main__":
 import doctest

 doctest.testmod()




"""simple docstring"""






from __future__ import annotations

from random import choice





def 	lowercase      (   __UpperCamelCase						) ->      Any:
 return choice(__UpperCamelCase						)





def 	lowercase      (   __UpperCamelCase      ,   __UpperCamelCase						) ->      int:
 __magic_name__     =      random_pivot(__UpperCamelCase						)

 # partition based on pivot
 # linear time
 __magic_name__     =      [e for e in lst if e < pivot]
 __magic_name__     =      [e for e in lst if e > pivot]

 # if we get lucky, pivot might be the element we want.
 # we can easily see this:
 # small (elements smaller than k)
 # + pivot (kth element)
 # + big (elements larger than k)
 if len(__UpperCamelCase						) == k - 1:
  return pivot
 # pivot is in elements bigger than k
 elif len(__UpperCamelCase						) < k - 1:
  return kth_number(__UpperCamelCase      ,   k - len(__UpperCamelCase						) - 1						)
 # pivot is in elements smaller than k
 else:
  return kth_number(__UpperCamelCase      ,   __UpperCamelCase						)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

