input: Write a function to create a web scraper that extracts specific data from a given website using the BeautifulSoup Python package. The function should return the extracted data in the desired format. If no data is found, it should return an empty list.
  
  def web_scraper(url, tag, attribute):
      import requests
      from bs4 import BeautifulSoup
      
      # Get the web page
      webpage = requests.get(url)
      
      # Parse the web page
      soup = BeautifulSoup(webpage.content, 'html.parser')
      
      # Find all elements with the specified tag and attribute
      elements = soup.find_all(tag)
      
      # Extract the data from the specified attribute
      data = [element.get(attribute) for element in elements if element.get(attribute)]
      
      return data
  
  assert web_scraper("http://example.com", 'a', 'href')==["http://example.com/page1", "http://example.com/page2"]
  assert web_scraper("http://example.com", 'img', 'src')==["http://example.com/image1.jpg", "http://example.com/image2.jpg"]
  assert web_scraper("http://example.com", 'p', 'class')==[]
  assert web_scraper("http://example.com", 'div', 'id')==["http://example.com/section1", "http://example.com/section2"]
  assert web_scraper("http://example.com", 'a', 'title')==[]
output: def web_scraper(url, tag, attribute):
      import requests
      from bs4 import BeautifulSoup
      
      webpage = requests.get(url)
      soup = BeautifulSoup(webpage.content, 'html.parser')
      elements = soup.find_all(tag)
      data = [element.get(attribute) for element in elements if element.get(attribute)]
      
      return data