



from __future__ import annotations

from typing import Generic, TypeVar

A__     				=	TypeVar("""T""")





class  __lowerCAmelCase			(					Generic[T]	):




    def __init__(							self						,    _snake_case		):



         """simple docstring"""





         _lowerCAmelCase      =   data  # Assign data
         _lowerCAmelCase      =   None  # Initialize next as null
         _lowerCAmelCase      =   None  # Initialize prev as null





class  __lowerCAmelCase			(					Generic[T]	):




    def __init__(							self		):



         """simple docstring"""





         _lowerCAmelCase      =   None




    def 							snake_case       (							self						,    _snake_case		):



         """simple docstring"""





         if self.head is None:
              _lowerCAmelCase      =   Node(_snake_case		)
         else:
              _lowerCAmelCase      =   Node(_snake_case		)
              _lowerCAmelCase      =   new_node
              _lowerCAmelCase      =   self.head
              _lowerCAmelCase      =   None
              _lowerCAmelCase      =   new_node




    def 							snake_case       (							self		):



         """simple docstring"""





         if self.head is None:
              return None
         else:
              assert self.head is not None
              _lowerCAmelCase      =   self.head.data
              _lowerCAmelCase      =   self.head.next
              if self.head is not None:
                   _lowerCAmelCase      =   None
              return temp




    def 							snake_case       (							self		):



         """simple docstring"""





         return self.head.data if self.head is not None else None




    def __len__(							self		):



         """simple docstring"""





         _lowerCAmelCase      =   self.head
         _lowerCAmelCase      =   0
         while temp is not None:
              count += 1
              _lowerCAmelCase      =   temp.next
         return count




    def 							snake_case       (							self		):



         """simple docstring"""





         return self.head is None




    def 							snake_case       (							self		):



         """simple docstring"""





         print("""stack elements are:"""		)
         _lowerCAmelCase      =   self.head
         while temp is not None:
              print(temp.data						,    end="""->"""		)
              _lowerCAmelCase      =   temp.next


# Code execution starts here
if __name__ == "__main__":
 # Start with the empty stack
 A__     				=	Stack()

 # Insert 4 at the beginning. So stack becomes 4->None
 print("""Stack operations using Doubly LinkedList""")
 stack.push(4)

 # Insert 5 at the beginning. So stack becomes 4->5->None
 stack.push(5)

 # Insert 6 at the beginning. So stack becomes 4->5->6->None
 stack.push(6)

 # Insert 7 at the beginning. So stack becomes 4->5->6->7->None
 stack.push(7)

 # Print the stack
 stack.print_stack()

 # Print the top element
 print("""\nTop element is """, stack.top())

 # Print the stack size
 print("""Size of the stack is """, len(stack))

 # pop the top element
 stack.pop()

 # pop the top element
 stack.pop()

 # two elements have now been popped off
 stack.print_stack()

 # Print True if the stack is empty else False
 print("""\nstack is empty:""", stack.is_empty())








from math import exp


def 		_UpperCAmelCase    (				snake_case      ):





					"""simple docstring"""

					return 8 * x - 2 * exp(-x      )


def 		_UpperCAmelCase    (				snake_case     ,						snake_case     ,						snake_case      ):





					"""simple docstring"""

					_lowerCAmelCase      =   lower_bound
					_lowerCAmelCase      =   upper_bound
					for _ in range(0     ,						snake_case      ):
										_lowerCAmelCase     ,     _lowerCAmelCase      =   xa, xa - (f(snake_case      ) * (xa - xa)) / (f(snake_case      ) - f(snake_case      ))
					return xa


if __name__ == "__main__":
	print(f"Example: {secant_method(1, 3, 2)}")



