
"""simple docstring"""





from __future__ import annotations

from typing import Any
class 						SCREAMING_SNAKE_CASE_ :




		"""simple docstring"""





		def __init__(     self							,  lowerCAmelCase__							,  lowerCAmelCase__							,  lowerCAmelCase__ = 0):
				__SCREAMING_SNAKE_CASE       ,__SCREAMING_SNAKE_CASE            = row, column
				__SCREAMING_SNAKE_CASE            = [[default_value for c in range(lowerCAmelCase__)] for r in range(lowerCAmelCase__)]




		def __str__(     self):
				__SCREAMING_SNAKE_CASE            = f"Matrix consist of {self.row} rows and {self.column} columns\n"

				# Make string identifier
				__SCREAMING_SNAKE_CASE            = 0
				for row_vector in self.array:
						for obj in row_vector:
								__SCREAMING_SNAKE_CASE            = max(lowerCAmelCase__							,  len(str(lowerCAmelCase__)))
				__SCREAMING_SNAKE_CASE            = f"%{max_element_length}s"

				# Make string and return
				def single_line(lowerCAmelCase__) -> str:
						nonlocal string_format_identifier
						__SCREAMING_SNAKE_CASE            = """["""
						line += ", ".join(string_format_identifier % (obj,) for obj in row_vector)
						line += "]"
						return line

				s += "\n".join(single_line(lowerCAmelCase__) for row_vector in self.array)
				return s




		def __repr__(     self):
				return str(self)




		def 	snake_case_     (     self							,  lowerCAmelCase__):
				if not (isinstance(lowerCAmelCase__							,  (list, tuple)) and len(lowerCAmelCase__) == 2):
						return False
				elif not (0 <= loc[0] < self.row and 0 <= loc[1] < self.column):
						return False
				else:
						return True




		def __getitem__(     self							,  lowerCAmelCase__):
				assert self.validate_indicies(lowerCAmelCase__)
				return self.array[loc[0]][loc[1]]




		def __setitem__(     self							,  lowerCAmelCase__							,  lowerCAmelCase__):
				assert self.validate_indicies(lowerCAmelCase__)
				__SCREAMING_SNAKE_CASE            = value




		def __add__(     self							,  lowerCAmelCase__):
				assert isinstance(lowerCAmelCase__							,  lowerCAmelCase__)
				assert self.row == another.row and self.column == another.column

				# Add
				__SCREAMING_SNAKE_CASE            = Matrix(self.row							,  self.column)
				for r in range(self.row):
						for c in range(self.column):
								__SCREAMING_SNAKE_CASE            = self[r, c] + another[r, c]
				return result




		def __neg__(     self):
				__SCREAMING_SNAKE_CASE            = Matrix(self.row							,  self.column)
				for r in range(self.row):
						for c in range(self.column):
								__SCREAMING_SNAKE_CASE            = -self[r, c]
				return result




		def __sub__(     self							,  lowerCAmelCase__):
				return self + (-another)




		def __mul__(     self							,  lowerCAmelCase__):

				if isinstance(lowerCAmelCase__							,  (int, float)):  # Scalar multiplication
						__SCREAMING_SNAKE_CASE            = Matrix(self.row							,  self.column)
						for r in range(self.row):
								for c in range(self.column):
										__SCREAMING_SNAKE_CASE            = self[r, c] * another
						return result
				elif isinstance(lowerCAmelCase__							,  lowerCAmelCase__):  # Matrix multiplication
						assert self.column == another.row
						__SCREAMING_SNAKE_CASE            = Matrix(self.row							,  another.column)
						for r in range(self.row):
								for c in range(another.column):
										for i in range(self.column):
												result[r, c] += self[r, i] * another[i, c]
						return result
				else:
						__SCREAMING_SNAKE_CASE            = f"Unsupported type given for another ({type(lowerCAmelCase__)})"
						raise TypeError(lowerCAmelCase__)




		def 	snake_case_     (     self):
				__SCREAMING_SNAKE_CASE            = Matrix(self.column							,  self.row)
				for r in range(self.row):
						for c in range(self.column):
								__SCREAMING_SNAKE_CASE            = self[r, c]
				return result




		def 	snake_case_     (     self							,  lowerCAmelCase__							,  lowerCAmelCase__):
				assert isinstance(lowerCAmelCase__							,  lowerCAmelCase__) and isinstance(lowerCAmelCase__							,  lowerCAmelCase__)
				assert self.row == self.column == u.row == v.row  # u, v should be column vector
				assert u.column == v.column == 1  # u, v should be column vector

				# Calculate
				__SCREAMING_SNAKE_CASE            = v.transpose()
				__SCREAMING_SNAKE_CASE            = (v_t * self * u)[0, 0] + 1
				if numerator_factor == 0:
						return None  # It's not invertable
				return self - ((self * u) * (v_t * self) * (1.0 / numerator_factor))


# Testing
if __name__ == "__main__":



							def 						_lowerCAmelCase				(				):
									# a^(-1)
									__SCREAMING_SNAKE_CASE            = Matrix(3  ,				3  ,				0				)
									for i in range(3				):
											__SCREAMING_SNAKE_CASE            = 1
									print(f"a^(-1) is {ainv}"				)
									# u, v
									__SCREAMING_SNAKE_CASE            = Matrix(3  ,				1  ,				0				)
									__SCREAMING_SNAKE_CASE       ,__SCREAMING_SNAKE_CASE       ,__SCREAMING_SNAKE_CASE            = 1, 2, -3
									__SCREAMING_SNAKE_CASE            = Matrix(3  ,				1  ,				0				)
									__SCREAMING_SNAKE_CASE       ,__SCREAMING_SNAKE_CASE       ,__SCREAMING_SNAKE_CASE            = 4, -2, 5
									print(f"u is {u}"				)
									print(f"v is {v}"				)
									print(f"uv^T is {u * v.transpose()}"				)
									# Sherman Morrison
									print(f"(a + uv^T)^(-1) is {ainv.sherman_morrison(UpperCamelCase_  ,				UpperCamelCase_				)}"				)



							def 						_lowerCAmelCase				(				):
									import doctest

									doctest.testmod()
							testa()






"""simple docstring"""





import requests
from bsa import BeautifulSoup



def 						_lowerCAmelCase				(				UpperCamelCase_ = "AAPL"				):
		__SCREAMING_SNAKE_CASE            = f"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}"
		__SCREAMING_SNAKE_CASE            = BeautifulSoup(requests.get(UpperCamelCase_				).text  ,				"""html.parser"""				)
		__SCREAMING_SNAKE_CASE            = """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}""")




