



from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier

# Load iris file
__UpperCAmelCase						  =     load_iris()
iris.keys()


print(f"""Target names: \n {iris.target_names} """)
print(f"""\n Features: \n {iris.feature_names}""")

# Train set e Test set
__UpperCAmelCase  ,							__UpperCAmelCase  ,							__UpperCAmelCase  ,							__UpperCAmelCase						  =     train_test_split(
    iris['''data'''], iris['''target'''], random_state=4
)

# KNN

__UpperCAmelCase						  =     KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
__UpperCAmelCase						  =     [[1, 2, 1, 4], [2, 3, 4, 5]]

__UpperCAmelCase						  =     knn.predict(X_new)

print(
    f"""\nNew array: \n {X_new}\n\nTarget Names Prediction: \n"""
    f""" {iris['target_names'][prediction]}"""
)










from __future__ import annotations

from typing import Generic, TypeVar

__UpperCAmelCase						  =     TypeVar('''T''')


class 	lowerCamelCase__ (		Generic[T]   ):


						def __init__( self						:  int      ,       _a						:  T			):
													a__:       int											=data  # Assign data
													a__:       Node[T] | None											=None  # Initialize next as null
													a__:       Node[T] | None											=None  # Initialize prev as null


class 	lowerCamelCase__ (		Generic[T]   ):


						def __init__( self						:  Optional[Any]			):
													a__:       Node[T] | None											=None


						def   _lowerCamelCase			( self						:  List[Any]      ,       _a						:  T			):
													if self.head is None:
																				a__:       Dict											=Node(_a			)
													else:
																				a__:       int											=Node(_a			)
																				a__:       Optional[Any]											=new_node
																				a__:       int											=self.head
																				a__:       int											=None
																				a__:       Any											=new_node


						def   _lowerCamelCase			( self						:  Tuple			):
													if self.head is None:
																				return None
													else:
																				assert self.head is not None
																				a__:       Optional[int]											=self.head.data
																				a__:       Union[str, Any]											=self.head.next
																				if self.head is not None:
																											a__:       str											=None
																				return temp


						def   _lowerCamelCase			( self						:  int			):
													return self.head.data if self.head is not None else None


						def __len__( self						:  Union[str, Any]			):
													a__:       Tuple											=self.head
													a__:       int											=0
													while temp is not None:
																				count += 1
																				a__:       List[str]											=temp.next
													return count


						def   _lowerCamelCase			( self						:  int			):
													return self.head is None







						def   _lowerCamelCase			( self						:  Union[str, Any]			):
													print("stack elements are:"			)
													a__:       Optional[int]											=self.head
													while temp is not None:
																				print(temp.data      ,       end="->"			)
																				a__:       Union[str, Any]											=temp.next


# Code execution starts here
if __name__ == "__main__":
		# Start with the empty stack
		__UpperCAmelCase						  =     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())





