input: Write a function to scrape the table at the given URL and extract the planets information (name, mass, and distance from the sun). If the URL is invalid or the table is not found, return an empty list.
  assert scrape_planets_info('https://en.wikipedia.org/wiki/List_of_gravitationally_rounded_objects_of_the_Solar_System') != []
  assert scrape_planets_info('https://invalid-url.com') == []
  assert scrape_planets_info('https://en.wikipedia.org/wiki/Non_Existent_Page') == []
output: import requests
  from bs4 import BeautifulSoup
  
  def scrape_planets_info(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, 'html.parser')
          table = soup.find('table', {'class': 'wikitable'})
          if not table:
              return []
          rows = table.find_all('tr')
          planets_info = []
          for row in rows[1:]:
              cols = row.find_all('td')
              if len(cols) >= 3:
                  name = cols[0].get_text(strip=True)
                  mass = cols[1].get_text(strip=True)
                  distance = cols[2].get_text(strip=True)
                  planets_info.append((name, mass, distance))
          return planets_info
      except (requests.RequestException, AttributeError):
          return []