


"""simple docstring"""

from itertools import zip_longest

import requests
from bsa import BeautifulSoup
from pandas import DataFrame


def lowerCAmelCase_   (					UpperCamelCase__						:			str = "laptop"			):






 """simple docstring"""







 __lowercase						=						f'''https://www.amazon.in/laptop/s?k={product}'''
 __lowercase						=						{
     """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						=						BeautifulSoup(requests.get(UpperCamelCase__					, headers=UpperCamelCase__			).text			)
 # Initialize a Pandas dataframe with the column titles
 __lowercase						=						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						=						item.ha.text
   __lowercase						=						"""https://www.amazon.in/""" + item.ha.a["""href"""]
   __lowercase						=						item.find("""span"""					, attrs={"""class""": """a-offscreen"""}			).text
   try:
    __lowercase						=						item.find("""span"""					, attrs={"""class""": """a-icon-alt"""}			).text
   except AttributeError:
    __lowercase						=						"""Not available"""
   try:
    __lowercase						=						(
        """₹"""
        + item.find(
            """span"""					, attrs={"""class""": """a-price a-text-price"""}			).text.split("""₹"""			)[1]
    )
   except AttributeError:
    __lowercase						=						""""""
   try:
    __lowercase						=						float(
        (
            (
                float(product_mrp.strip("""₹"""			).replace(""","""					, """"""			)			)
                - float(product_price.strip("""₹"""			).replace(""","""					, """"""			)			)
            )
            / float(product_mrp.strip("""₹"""			).replace(""","""					, """"""			)			)
        )
        * 100			)
   except ValueError:
    __lowercase						=						float("""nan"""			)
  except AttributeError:
   pass
  __lowercase						=						[
      product_title,
      product_link,
      product_price,
      product_rating,
      product_mrp,
      discount,
  ]
 __lowercase						=						""" """
 __lowercase						=						""" """
 data_frame.index += 1
 return data_frame


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




"""simple docstring"""

def lowerCAmelCase_   (					UpperCamelCase__						:			int					, UpperCamelCase__						:			int			):






 """simple docstring"""







 return x if y == 0 else greatest_common_divisor(UpperCamelCase__					, x % y			)


def lowerCAmelCase_   (					UpperCamelCase__						:			int					, UpperCamelCase__						:			int			):






 """simple docstring"""







 return (x * y) // greatest_common_divisor(UpperCamelCase__					, UpperCamelCase__			)


def lowerCAmelCase_   (					UpperCamelCase__						:			int = 20			):






 """simple docstring"""







 __lowercase						=						1
 for i in range(1					, n + 1			):
  __lowercase						=						lcm(UpperCamelCase__					, UpperCamelCase__			)
 return g


if __name__ == "__main__":
       print(f"""{solution() = }""")
