






"""simple docstring"""







from collections.abc import Callable

import numpy as np


def      UpperCamelCase       ( _A  ,				_A  ,				_A  ,				_A  ,				_A )     ->       np.array:
				lowercase    :      Optional[Any]       = int(np.ceil((x_end - xa) / step_size ) )
				lowercase    :      str       = np.zeros((n + 1,) )
				lowercase    :      List[Any]       = ya
				lowercase    :      Optional[int]       = xa

				for k in range(_A ):
								lowercase    :      Any       = y[k] + step_size * ode_func(_A  ,				y[k] )
								lowercase    :      Tuple       = y[k] + (
								    (step_size / 2) * (ode_func(_A  ,				y[k] ) + ode_func(x + step_size  ,				_A ))
								)
								x += step_size

				return y


if __name__ == "__main__":
				import doctest

				doctest.testmod()








"""simple docstring"""







from itertools import zip_longest

import requests
from bsa import BeautifulSoup
from pandas import DataFrame


def      UpperCamelCase       ( _A = "laptop" )     ->       DataFrame:
				lowercase    :      List[str]       = F"""https://www.amazon.in/laptop/s?k={product}"""
				lowercase    :      str       = {
				    """User-Agent""": """Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
        (KHTML, like Gecko)Chrome/44.0.2403.157 Safari/537.36""",
				    """Accept-Language""": """en-US, en;q=0.5""",
				}
				lowercase    :      str       = BeautifulSoup(requests.get(_A  ,				headers=_A ).text )
				# Initialize a Pandas dataframe with the column titles
				lowercase    :      Optional[Any]       = DataFrame(
				    columns=[
				        """Product Title""",
				        """Product Link""",
				        """Current Price of the product""",
				        """Product Rating""",
				        """MRP of the product""",
				        """Discount""",
				    ] )
				# Loop through each entry and store them in the dataframe
				for item, _ in zip_longest(
				    soup.find_all(
				        """div"""  ,				attrs={"""class""": """s-result-item""", """data-component-type""": """s-search-result"""}  ,				)  ,				soup.find_all("""div"""  ,				attrs={"""class""": """a-row a-size-base a-color-base"""} )  ,				):
								try:
												lowercase    :      str       = item.ha.text
												lowercase    :      Tuple       = """https://www.amazon.in/""" + item.ha.a["""href"""]
												lowercase    :      Tuple       = item.find("""span"""  ,				attrs={"""class""": """a-offscreen"""} ).text
												try:
																lowercase    :      Any       = item.find("""span"""  ,				attrs={"""class""": """a-icon-alt"""} ).text
												except AttributeError:
																lowercase    :      Tuple       = """Not available"""
												try:
																lowercase    :      Any       = (
																    """₹"""
																    + item.find(
																        """span"""  ,				attrs={"""class""": """a-price a-text-price"""} ).text.split("""₹""" )[1]
																)
												except AttributeError:
																lowercase    :      Any       = """"""
												try:
																lowercase    :      List[str]       = float(
																    (
																        (
																            float(product_mrp.strip("""₹""" ).replace(""","""  ,				"""""" ) )
																            - float(product_price.strip("""₹""" ).replace(""","""  ,				"""""" ) )
																        )
																        / float(product_mrp.strip("""₹""" ).replace(""","""  ,				"""""" ) )
																    )
																    * 100 )
												except ValueError:
																lowercase    :      Tuple       = float("""nan""" )
								except AttributeError:
												pass
								lowercase    :      Union[str, Any]       = [
								    product_title,
								    product_link,
								    product_price,
								    product_rating,
								    product_mrp,
								    discount,
								]
				lowercase    :      Tuple       = """ """
				lowercase    :      List[str]       = """ """
				data_frame.index += 1
				return data_frame


if __name__ == "__main__":
				_lowerCAmelCase            =	'headphones'
				get_amazon_product_data(product).to_csv(F'Amazon Product Data for {product}.csv')
