


from __future__ import annotations

from typing import Any



class 							a       :





     def __init__(     self       :					int     ,						SCREAMING_SNAKE_CASE_       :					Any     ,						SCREAMING_SNAKE_CASE_       :					Any				):  # noqa: A002
        __lowerCamelCase:					List[Any]	 =						item
        __lowerCamelCase:					Tuple	 =						next



class 							a       :





     def __init__(     self       :					List[str]				):
        __lowerCamelCase:					Node | None	 =						None
        __lowerCamelCase:					Tuple	 =						0





     def 			SCREAMING_SNAKE_CASE__							(     self       :					Any     ,						SCREAMING_SNAKE_CASE_       :					Any				):
        __lowerCamelCase:					List[str]	 =						Node(SCREAMING_SNAKE_CASE_     ,						self.head				)
        self.size += 1





     def 			SCREAMING_SNAKE_CASE__							(     self       :					Any				):
        # Switched 'self.is_empty()' to 'self.head is None'
        # because mypy was considering the possibility that 'self.head'
        # can be None in below else part and giving error
        if self.head is None:
           return None
        else:
           __lowerCamelCase:					Optional[int]	 =						self.head.item
           __lowerCamelCase:					int	 =						self.head.next
           self.size -= 1
           return item





     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[Any]				):
        return self.head is None





     def __str__(     self       :					Optional[int]				):
        if self.is_empty():
           return ""
        else:
           __lowerCamelCase:					Optional[Any]	 =						self.head
           __lowerCamelCase:					Tuple	 =						""""""
           __lowerCamelCase:					list[str]	 =						[]
           while iterate:
              item_list.append(str(iterate.item				)				)
              __lowerCamelCase:					str	 =						iterate.next

           __lowerCamelCase:					int	 =						""" --> """.join(SCREAMING_SNAKE_CASE_				)

           return item_str







     def __len__(     self       :					List[str]				):
        return self.size






_A		:					Union[str, Any]          =							1_000



def      __lowerCAmelCase    (				snake_case						:     float			)							->				float:
   return x * x



def      __lowerCAmelCase    (				snake_case						:     Optional[int]    ,   snake_case						:     float    ,   snake_case						:     float    ,   snake_case						:     int = 4			)							->				float:
   assert callable(
       snake_case			), f'the function(object) passed should be callable your input : {function}'
   assert isinstance(snake_case    ,   (float, int)			), f'a should be float or integer your input : {a}'
   assert isinstance(function(snake_case			)    ,   (float, int)			), (
       "the function should return integer or float return type of your function, "
       f'{type(snake_case			)}'
   )
   assert isinstance(snake_case    ,   (float, int)			), f'b should be float or integer your input : {b}'
   assert (
       isinstance(snake_case    ,   snake_case			) and precision > 0
   ), f'precision should be positive integer your input : {precision}'

   # just applying the formula of simpson for approximate integration written in
   # mentioned article in first comment of this file and above this function

   __lowerCamelCase:					List[str]	 =						(b - a) / N_STEPS
   __lowerCamelCase:					Optional[Any]	 =						function(snake_case			) + function(snake_case			)

   for i in range(1    ,   snake_case			):
      __lowerCamelCase:					Dict	 =						a + h * i
      result += function(snake_case			) * (4 if i % 2 else 2)

   result *= h / 3
   return round(snake_case    ,   snake_case			)


if __name__ == "__main__":
   import doctest

   doctest.testmod()


