input: Write a python function to scrape the titles of all articles from a given URL.
  assert scrape('https://example.com/articles') == ['Title 1', 'Title 2', 'Title 3']
  assert scrape('https://example.com/news') == ['News 1', 'News 2', 'News 3']
  assert scrape('https://example.com/blog') == ['Blog Post 1', 'Blog Post 2', 'Blog Post 3']
output: def scrape(url):
      import requests
      from bs4 import BeautifulSoup
  
      response = requests.get(url)
      soup = BeautifulSoup(response.text, 'html.parser')
  
      titles = []
      for article in soup.find_all('article'):
          title = article.find('h2')
          if title:
              titles.append(title.get_text())
  
      return titles