input: Write a function to scrape a webpage and collect all the links present on the webpage. The function should take the URL of the webpage as input and return a list of all the links found on that webpage. If there are no links, it should return an empty list.
  
  
  def collect_links(url):
      import requests as req
      from bs4 import BeautifulSoup
      
      r = req.get(url)
      soup = BeautifulSoup(r.text, "html.parser")
      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("http://nonexistentwebsite.com/")==[]
  assert collect_links("http://example.com/nolinks")==[]
  assert collect_links("http://example.com/multiplelinks")==["http://link1.com", "http://link2.com", "http://link3.com"]
  assert collect_links("http://example.com/linkswithsubpages")==["http://link1.com", "http://link2.com", "http://subpage1.com", "http://subpage2.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 []