input: Write a function to scrape a webpage and collect all the links from it. The function should return a list of all the links found on the webpage. If no links are found, return an empty list.
  
  
  import requests as req 
  from bs4 import BeautifulSoup 
  
  def scrape_links(url):
      # GET request 
      r = req.get(url) 
      
      # parse the downloaded homepage and grab all text
      soup = BeautifulSoup(r.text, "html.parser") 
      
      # find and collect all links 
      links = [link.get('href') for link in soup.find_all('a')]
      
      return links
  
  # Test cases
  assert scrape_links("http://www.example.com/") == ['http://www.iana.org/domains/example']
  assert scrape_links("http://www.nonexistentwebsite.com/") == []
  assert scrape_links("http://www.google.com/") != []
  
output: import requests as req 
  from bs4 import BeautifulSoup 
  
  def scrape_links(url):
      try:
          r = req.get(url) 
          soup = BeautifulSoup(r.text, "html.parser") 
          links = [link.get('href') for link in soup.find_all('a')]
          return links
      except:
          return []