input: Write a function to create a web scraper that extracts specific data from a given website. The scraper should utilize the Python package BeautifulSoup to parse webpages and extract the required data. BeautifulSoup will allow us to find HTML elements on the webpage using tags and attributes, and then convert the data into the desired format and store it. If the webpage is inaccessible or the data cannot be found, the function should return an error message.
  
  def extract_data(url):
      import requests
      from bs4 import BeautifulSoup
  
      # Get the web page
      webpage = requests.get(url)
  
      # Check if the webpage is accessible
      if webpage.status_code != 200:
          return "Error: Webpage is inaccessible"
  
      # Parse the web page
      soup = BeautifulSoup(webpage.content, 'html.parser')
  
      # Example: Find all 'a' tags and extract the URLs in the 'href' attribute
      links = soup.find_all('a')
      extracted_data = []
      for link in links:
          extracted_data.append(link.get('href'))
  
      return extracted_data
  
  assert extract_data("https://example.com")==["/about", "/contact", "/services"]
  assert extract_data("https://example.com/about")==["/contact", "/services"]
  assert extract_data("https://nonexistentwebsite.com")=="Error: Webpage is inaccessible"
  assert extract_data("https://example.com/no_links")==[]
output: def extract_data(url):
      import requests
      from bs4 import BeautifulSoup
  
      webpage = requests.get(url)
  
      if webpage.status_code != 200:
          return "Error: Webpage is inaccessible"
  
      soup = BeautifulSoup(webpage.content, 'html.parser')
  
      links = soup.find_all('a')
      extracted_data = []
      for link in links:
          extracted_data.append(link.get('href'))
  
      return extracted_data