



from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

__UpperCAmelCase      = '''https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true'''
def 	UpperCamelCase			(     snake_case__ :					str ,  snake_case__ :					str			)			->  list | None:

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

      UpperCamelCase					:						int					=			BASE_URL.format(snake_case__ ,  snake_case__			)
      UpperCamelCase					:						str					=			get(snake_case__			)

      # Is the response ok?
      response.raise_for_status()

      # Scrape the data using bs4
      UpperCamelCase					:						str					=			BeautifulSoup(response.text ,  'html.parser'			)

      # This list will store the name and price.
      UpperCamelCase					:						Tuple					=			[]

      # Fetch all the grids that contains the items.
      UpperCamelCase					:						Any					=			soup.find_all('div' ,  {'class': 'grid-x pharmCard'}			)
      if grid_list and len(snake_case__			) > 0:
         for grid in grid_list:
            # Get the pharmacy price.
            UpperCamelCase					:						List[str]					=			grid.find('p' ,  {'class': 'list-title'}			).text

            # Get price of the drug.
            UpperCamelCase					:						Dict					=			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
    __UpperCAmelCase      = input('''Enter drug name: ''').strip()
    __UpperCAmelCase      = input('''Enter zip code: ''').strip()

    __UpperCAmelCase      = 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:
            __UpperCAmelCase      = pharmacy_price['''pharmacy_name''']
            __UpperCAmelCase      = pharmacy_price['''price''']

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








from __future__ import annotations

import sys
def 	UpperCamelCase			(     snake_case__ :					int ,  snake_case__ :					int			)			->  tuple[int, int]:
   # base cases
   if abs(snake_case__			) == 1:
      return a, 0
   elif abs(snake_case__			) == 1:
      return 0, b

   UpperCamelCase			,  UpperCamelCase					:						Dict					=			a, b
   UpperCamelCase			,  UpperCamelCase					:						int					=			1, 0
   UpperCamelCase			,  UpperCamelCase					:						Union[str, Any]					=			0, 1

   while remainder != 0:
      UpperCamelCase					:						str					=			old_remainder // remainder
      UpperCamelCase			,  UpperCamelCase					:						Union[str, Any]					=			remainder, old_remainder - quotient * remainder
      UpperCamelCase			,  UpperCamelCase					:						List[Any]					=			coeff_a, old_coeff_a - quotient * coeff_a
      UpperCamelCase			,  UpperCamelCase					:						Optional[Any]					=			coeff_b, old_coeff_b - quotient * coeff_b

   # sign correction for negative numbers
   if a < 0:
      UpperCamelCase					:						Dict					=			-old_coeff_a
   if b < 0:
      UpperCamelCase					:						Any					=			-old_coeff_b

   return old_coeff_a, old_coeff_b
def 	UpperCamelCase			(     )			->  Tuple:
   if len(sys.argv			) < 3:
      print('2 integer arguments required'			)
      return 1
   UpperCamelCase					:						Union[str, Any]					=			int(sys.argv[1]			)
   UpperCamelCase					:						Optional[int]					=			int(sys.argv[2]			)
   print(extended_euclidean_algorithm(snake_case__ ,  snake_case__			)			)
   return 0


if __name__ == "__main__":
    raise SystemExit(main())



