


from __future__ import annotations

import math

import numpy as np
from numpy.linalg import norm
def   _UpperCamelCase				(						lowerCAmelCase_  ,						lowerCAmelCase_   )						->float:
   return math.sqrt(sum(pow(a - b  ,						2   ) for a, b in zip(lowerCAmelCase_  ,						lowerCAmelCase_   )   )   )
def   _UpperCamelCase				(						lowerCAmelCase_  ,						lowerCAmelCase_   )						->list[list[list[float] | float]]:

   if dataset.ndim != value_array.ndim:
      UpperCAmelCase							=     (
          """Wrong input data's dimensions... """
          F"""dataset : {dataset.ndim}, value_array : {value_array.ndim}"""
      )
      raise ValueError(lowerCAmelCase_   )

   try:
      if dataset.shape[1] != value_array.shape[1]:
         UpperCAmelCase							=     (
             """Wrong input data's shape... """
             F"""dataset : {dataset.shape[1]}, value_array : {value_array.shape[1]}"""
         )
         raise ValueError(lowerCAmelCase_   )
   except IndexError:
      if dataset.ndim != value_array.ndim:
         raise TypeError("""Wrong shape"""   )

   if dataset.dtype != value_array.dtype:
      UpperCAmelCase							=     (
          """Input data have different datatype... """
          F"""dataset : {dataset.dtype}, value_array : {value_array.dtype}"""
      )
      raise TypeError(lowerCAmelCase_   )

   UpperCAmelCase							=     []

   for value in value_array:
      UpperCAmelCase							=     euclidean(lowerCAmelCase_  ,						dataset[0]   )
      UpperCAmelCase							=     dataset[0].tolist()

      for dataset_value in dataset[1:]:
         UpperCAmelCase							=     euclidean(lowerCAmelCase_  ,						lowerCAmelCase_   )

         if dist > temp_dist:
            UpperCAmelCase							=     temp_dist
            UpperCAmelCase							=     dataset_value.tolist()

      answer.append([vector, dist]   )

   return answer
def   _UpperCamelCase				(						lowerCAmelCase_  ,						lowerCAmelCase_   )						->float:
   return np.dot(lowerCAmelCase_  ,						lowerCAmelCase_   ) / (norm(lowerCAmelCase_   ) * norm(lowerCAmelCase_   ))


if __name__ == "__main__":
 import doctest

 doctest.testmod()







def   _UpperCamelCase				(						lowerCAmelCase_  ,						lowerCAmelCase_   )						->int:
   return int((input_a, input_a).count(0   ) == 0   )
def   _UpperCamelCase				(						)						->None:
   assert and_gate(0  ,						0   ) == 0
   assert and_gate(0  ,						1   ) == 0
   assert and_gate(1  ,						0   ) == 0
   assert and_gate(1  ,						1   ) == 1


if __name__ == "__main__":
 test_and_gate()
 print(and_gate(1, 0))
 print(and_gate(0, 0))
 print(and_gate(0, 1))
 print(and_gate(1, 1))



