

"""simple docstring"""







from __future__ import annotations

from collections.abc import Generator


def   a__      (		UpperCAmelCase__       :			int			)->	Generator[int, None, None]:
						if not isinstance(a_		,			a_			) or n < 1:
												raise Exception("""Sequence only defined for positive integers"""			)

						yield n
						while n != 1:
												if n % 2 == 0:
																		n //= 2
												else:
																		UpperCAmelCase__						=		3 * n + 1
												yield n


def   a__      (		)->	Tuple:
						UpperCAmelCase__						=		4_3
						UpperCAmelCase__						=		tuple(collatz_sequence(a_			)			)
						print(a_			)
						print(f'Collatz sequence from {n} took {len(a_			)} steps.'			)


if __name__ == "__main__":
						main()


"""simple docstring"""







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

# Load iris file
UpperCamelCase_       :       Optional[int]							   =		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_       :       int							   =		train_test_split(
    iris["""data"""], iris["""target"""], random_state=4
)

# KNN

UpperCamelCase_       :       str							   =		KNeighborsClassifier(n_neighbors=1)
knn.fit(X_train, y_train)

# new array to test
UpperCamelCase_       :       Union[str, Any]							   =		[[1, 2, 1, 4], [2, 3, 4, 5]]

UpperCamelCase_       :       Union[str, Any]							   =		knn.predict(X_new)

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

