input: Write a function to extract the latest stock prices from specific websites using web scraping techniques in Python. The function should take a list of stock names as input, fetch the stock prices from the Yahoo Finance website using the requests and BeautifulSoup libraries, and return the prices. If the stock price cannot be fetched, the function should handle the exception and print an appropriate message.
  
  def get_stock_price(stocks):
      import requests
      from bs4 import BeautifulSoup
      prices = []
      for stock in stocks:
          try:
              url = f"https://finance.yahoo.com/quote/{stock}"
              response = requests.get(url)
              soup = BeautifulSoup(response.text, 'html.parser')
              price = soup.find('div', {'class': 'My(6px) Pos(r) smartphone_Mt(6px)'}).find('span').text
              prices.append(price)
          except Exception as e:
              print(f"Could not fetch price for {stock}: {e}")
              prices.append(None)
      return prices
  
  assert get_stock_price(["AAPL stocks", "MSFT stocks", "FB stocks", "GOOG stocks"]) == ["150.00", "300.50", "350.25", "2800.75"]
  assert get_stock_price(["TSLA stocks"]) == ["750.50"]
  assert get_stock_price([]) == []
output: def get_stock_price(stocks):
      import requests
      from bs4 import BeautifulSoup
      prices = []
      for stock in stocks:
          try:
              url = f"https://finance.yahoo.com/quote/{stock}"
              response = requests.get(url)
              soup = BeautifulSoup(response.text, 'html.parser')
              price = soup.find('div', {'class': 'My(6px) Pos(r) smartphone_Mt(6px)'}).find('span').text
              prices.append(price)
          except Exception as e:
              print(f"Could not fetch price for {stock}: {e}")
              prices.append(None)
      return prices