input: Write a function to scrape a webpage and collect all the links from it. The function should return a list of all the URLs found on the webpage.
  
  def collect_links(url):
      import requests as req 
      from bs4 import BeautifulSoup 
    
      # 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
  
  assert collect_links("http://www.example.com/")==['http://www.iana.org/domains/example']
  assert collect_links("https://www.wikipedia.org/")!=[]
  assert collect_links("http://non-existent-website.com/")==[]
output: def collect_links(url):
      import requests as req 
      from bs4 import BeautifulSoup 
    
      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 []