


from PIL import Image
def 							UpperCamelCase_(					_A :Image	)->		Image:
			UpperCamelCase__,   UpperCamelCase__       =							image.size
			UpperCamelCase__       =							0
			UpperCamelCase__       =							image.load()
			for i in range(_A	):
						for j in range(_A	):
									UpperCamelCase__       =							pixels[j, i]
									mean += pixel
			mean //= width * height

			for j in range(_A	):
						for i in range(_A	):
									UpperCamelCase__       =							2_55 if pixels[i, j] > mean else 0
			return image


if __name__ == "__main__":
						__UpperCamelCase     		=							mean_threshold(Image.open('path_to_image').convert('L'))
						image.save('output_image_path')






import requests
from bsa import BeautifulSoup
def 							UpperCamelCase_(					_A :str = "AAPL"	)->		str:
			UpperCamelCase__       =							F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
			UpperCamelCase__       =							BeautifulSoup(requests.get(_A	).text					,  "html.parser"	)
			UpperCamelCase__       =							"My(6px) Pos(r) smartphone_Mt(6px)"
			return soup.find("div"					,  class_=class_	).find("span"	).text


if __name__ == "__main__":
						for symbol in "AAPL AMZN IBM GOOG MSFT ORCL".split():
												print(f'''Current {symbol:<4} stock price is {stock_price(symbol):>8}''')


