input: Write a function to design a script in Python to scrape photos and captions from a given website. The function should take a website URL as input and print the photo source and its caption if available. If no caption is available, it should print 'No caption'. If the given URL is invalid or the page does not contain any photos, the function should print an appropriate message.
  assert scrape_photos_and_captions('https://example.com/webpage_with_images')==None
  assert scrape_photos_and_captions('https://example.com/webpage_without_images')==None
  assert scrape_photos_and_captions('https://invalidurl.com')==None
output: import requests
  from bs4 import BeautifulSoup
  
  def scrape_photos_and_captions(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
      except requests.exceptions.RequestException:
          print("Invalid URL or unable to fetch the page.")
          return
      
      soup = BeautifulSoup(response.text, 'html.parser')
      images = soup.find_all('img')
      
      if not images:
          print("No photos found on the page.")
          return
      
      for img in images:
          src = img.get('src')
          caption = img.find_next('figcaption') or img.find_next('p')
          if caption:
              print(f"Photo source: {src}, Caption: {caption.text.strip()}")
          else:
              print(f"Photo source: {src}, No caption")