input: Write a function to scrape photos and captions from a given website URL and print them. If a photo does not have a caption, print "No caption" instead. If the website URL is incorrect or does not return an HTTP 200 status code, print an error message.
  from bs4 import BeautifulSoup
  import requests
  
  def scrape_photos_captions(url):
      try:
          req = requests.get(url)
          req.raise_for_status()
      except requests.exceptions.RequestException as e:
          print(f"Error fetching the URL: {e}")
          return
  
      html = req.text
      soup = BeautifulSoup(html, features='lxml')
      image_divs = soup.find_all('div', {'class': 'image-gallery__image'})
  
      for image_div in image_divs:
          figure = image_div.find('figure')
          src = figure.find('img')['src']
          caption = figure.find('figcaption')
          print('Photo: ', src)
          if caption:
              print('Caption: ', caption.text)
          else:
              print('No caption')
          print('\n')
  
  assert scrape_photos_captions('https://example.com/webpage')==None
  assert scrape_photos_captions('https://nonexistenturl.com')==None
output: from bs4 import BeautifulSoup
  import requests
  
  def scrape_photos_captions(url):
      try:
          req = requests.get(url)
          req.raise_for_status()
      except requests.exceptions.RequestException as e:
          print(f"Error fetching the URL: {e}")
          return
  
      html = req.text
      soup = BeautifulSoup(html, features='lxml')
      image_divs = soup.find_all('div', {'class': 'image-gallery__image'})
  
      for image_div in image_divs:
          figure = image_div.find('figure')
          src = figure.find('img')['src']
          caption = figure.find('figcaption')
          print('Photo: ', src)
          if caption:
              print('Caption: ', caption.text)
          else:
              print('No caption')
          print('\n')