input: Write a function to scrape an online news website to extract the headlines from the webpage. The function should return a list of headlines. If there are no headlines, the function should return an empty list. 
  
  def scrape_headlines(url):
      import requests
      from bs4 import BeautifulSoup 
  
      # get the response in the form of html
      r = requests.get(url) 
  
      # check if the response is successful
      if r.status_code != 200:
          return []
  
      # create a beautifulsoup object to parse contents 
      soup = BeautifulSoup(r.content, 'html5lib') 
  
      # find headlines from the parsed page  
      headlines = soup.find_all('h2') 
  
      # Extract the text from each headline and return as a list
      return [headline.text for headline in headlines]
  
  assert scrape_headlines("https://www.news.com/") == ["Headline1", "Headline2", "Headline3"]
  assert scrape_headlines("https://www.non_existent_news.com/") == []
output: def scrape_headlines(url):
      import requests
      from bs4 import BeautifulSoup 
  
      # get the response in the form of html
      r = requests.get(url) 
  
      # check if the response is successful
      if r.status_code != 200:
          return []
  
      # create a beautifulsoup object to parse contents 
      soup = BeautifulSoup(r.content, 'html5lib') 
  
      # find headlines from the parsed page  
      headlines = soup.find_all('h2') 
  
      # Extract the text from each headline and return as a list
      return [headline.text for headline in headlines]