

from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

SCREAMING_SNAKE_CASE						:Dict      =			"""https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"""




def        lowerCAmelCase(	SCREAMING_SNAKE_CASE_       ,		SCREAMING_SNAKE_CASE_       )->		list | None:



    """simple docstring"""






    try:
        # Has user provided both inputs?
        if not drug_name or not zip_code:
            return None

        UpperCamelCase_          =		BASE_URL.format(SCREAMING_SNAKE_CASE_       ,		SCREAMING_SNAKE_CASE_       )
        UpperCamelCase_          =		get(SCREAMING_SNAKE_CASE_       )

        # Is the response ok?
        response.raise_for_status()

        # Scrape the data using bs4
        UpperCamelCase_          =		BeautifulSoup(response.text       ,		"html.parser"       )

        # This list will store the name and price.
        UpperCamelCase_          =		[]

        # Fetch all the grids that contains the items.
        UpperCamelCase_          =		soup.find_all("div"       ,		{"class": "grid-x pharmCard"}       )
        if grid_list and len(SCREAMING_SNAKE_CASE_       ) > 0:
            for grid in grid_list:
                # Get the pharmacy price.
                UpperCamelCase_          =		grid.find("p"       ,		{"class": "list-title"}       ).text

                # Get price of the drug.
                UpperCamelCase_          =		grid.find("span"       ,		{"p", "price price-large"}       ).text

                pharmacy_price_list.append(
                    {
                        "pharmacy_name": pharmacy_name,
                        "price": price,
                    }       )

        return pharmacy_price_list

    except (HTTPError, exceptions.RequestException, ValueError):
        return None


if __name__ == "__main__":
 # Enter a drug name and a zip code
 SCREAMING_SNAKE_CASE						:int      =			input("""Enter drug name: """).strip()
 SCREAMING_SNAKE_CASE						:str      =			input("""Enter zip code: """).strip()

 SCREAMING_SNAKE_CASE						:list | None      =			fetch_pharmacy_and_price_list(
     drug_name, zip_code
 )

 if pharmacy_price_list:
  print(F'''\nSearch results for {drug_name} at location {zip_code}:''')
  for pharmacy_price in pharmacy_price_list:
   SCREAMING_SNAKE_CASE						:str      =			pharmacy_price["""pharmacy_name"""]
   SCREAMING_SNAKE_CASE						:Tuple      =			pharmacy_price["""price"""]

   print(F'''Pharmacy: {name} Price: {price}''')
 else:
  print(F'''No results found for {drug_name}''')



class 		__magic_name__ :






     def __init__(							self     )->			int:
         UpperCamelCase_          =		[0]
         UpperCamelCase_          =		0






     def      UpperCAmelCase_							(							self						,		_lowercase     )->			None:
         UpperCamelCase_          =		self.__heap[i]
         while i // 2 > 0:
             if self.__heap[i] > self.__heap[i // 2]:
                 UpperCamelCase_          =		self.__heap[i // 2]
                 UpperCamelCase_          =		temporary
             i //= 2






     def      UpperCAmelCase_							(							self						,		_lowercase     )->			None:
         self.__heap.append(_lowercase     )
         self.__size += 1
         self.__swap_up(self.__size     )






     def      UpperCAmelCase_							(							self						,		_lowercase     )->			None:
         while self.__size >= 2 * i:
             if 2 * i + 1 > self.__size:
                 UpperCamelCase_          =		2 * i
             else:
                 if self.__heap[2 * i] > self.__heap[2 * i + 1]:
                     UpperCamelCase_          =		2 * i
                 else:
                     UpperCamelCase_          =		2 * i + 1
             UpperCamelCase_          =		self.__heap[i]
             if self.__heap[i] < self.__heap[bigger_child]:
                 UpperCamelCase_          =		self.__heap[bigger_child]
                 UpperCamelCase_          =		temporary
             UpperCamelCase_          =		bigger_child






     def      UpperCAmelCase_							(							self     )->			int:
         UpperCamelCase_          =		self.__heap[1]
         UpperCamelCase_          =		self.__heap[self.__size]
         self.__size -= 1
         self.__heap.pop()
         self.__swap_down(1     )
         return max_value






     @property
     def      UpperCAmelCase_							(							self     )->			List[Any]:
         return self.__heap[1:]






     def __len__(							self     )->			List[str]:
         return self.__size


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 # create an instance of BinaryHeap
 SCREAMING_SNAKE_CASE						:Optional[int]      =			BinaryHeap()
 binary_heap.insert(6)
 binary_heap.insert(10)
 binary_heap.insert(15)
 binary_heap.insert(12)
 # pop root(max-values because it is max heap)
 print(binary_heap.pop())  # 15
 print(binary_heap.pop())  # 12
 # get the list and size after operations
 print(binary_heap.get_list)
 print(len(binary_heap))
