
import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
							print("""Googling.....""")
							UpperCamelCase_						:     str	       =							"""https://www.google.com/search?q=""" + """ """.join(sys.argv[1:])
							UpperCamelCase_						:     int	       =							requests.get(url, headers={"""UserAgent""": UserAgent().random})
							# res.raise_for_status()
							with open("""project1a.html""", """wb""") as out_file:  # only for knowing the class
														for data in res.iter_content(1_0000):
																					out_file.write(data)
							UpperCamelCase_						:     Dict	       =							BeautifulSoup(res.text, """html.parser""")
							UpperCamelCase_						:     List[Any]	       =							list(soup.select(""".eZt8xd"""))[:5]

							print(len(links))
							for link in links:
														if link.text == "Maps":
																					webbrowser.open(link.get("""href"""))
														else:
																					webbrowser.open(f'''https://google.com{link.get("href")}''')






import math




class   __lowercase						:






	def       _a(self				: Dict      ,	snake_case				: list[list[float]]      ,	snake_case				: list[int]    ) ->			int:
							_lowercase       :	List[Any]           =   0.0
							_lowercase       :	Any           =   0.0
							for i in range(len(snake_case    )    ):
													da += math.pow((sample[i] - weights[0][i])      ,	2    )
													da += math.pow((sample[i] - weights[1][i])      ,	2    )
													return 0 if da > da else 1
							return 0






	def       _a(self				: Dict      ,	snake_case				: list[list[int | float]]      ,	snake_case				: list[int]      ,	snake_case				: int      ,	snake_case				: float    ) ->			list[list[int | float]]:
							for i in range(len(snake_case    )    ):
													weights[j][i] += alpha * (sample[i] - weights[j][i])
							return weights



def 		UpperCamelCase     (       )   ->			None:






						'''simple docstring'''

						_lowercase       :	Union[str, Any]           =   [[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

						# weight initialization ( n, C )
						_lowercase       :	Tuple           =   [[0.2, 0.6, 0.5, 0.9], [0.8, 0.4, 0.7, 0.3]]

						# training
						_lowercase       :	List[Any]           =   SelfOrganizingMap()
						_lowercase       :	Any           =   3
						_lowercase       :	Optional[Any]           =   0.5

						for _ in range(_UpperCAmelCase  ):
												for j in range(len(_UpperCAmelCase  )  ):
																		# training sample
																		_lowercase       :	Optional[int]           =   training_samples[j]

																		# Compute the winning vector
																		_lowercase       :	Tuple           =   self_organizing_map.get_winner(_UpperCAmelCase ,			_UpperCAmelCase  )

																		# Update the winning vector
																		_lowercase       :	str           =   self_organizing_map.update(_UpperCAmelCase ,			_UpperCAmelCase ,			_UpperCAmelCase ,			_UpperCAmelCase  )

    # classify test sample
						_lowercase       :	Any           =   [0, 0, 0, 1]
						_lowercase       :	Dict           =   self_organizing_map.get_winner(_UpperCAmelCase ,			_UpperCAmelCase  )

						# results
						print(f"""Clusters that the test sample belongs to : {winner}"""  )
						print(f"""Weights that have been trained : {weights}"""  )


# running the main() function
if __name__ == "__main__":
							main()




