url = "https://example.com/products"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

<span class="code-comment"># Extract product information</span>
products = []
for product_div in soup.find_all('div', class_='product'):
    product = {
        'name': product_div.find('h3', class_='product-name').text.strip(),
        'price': product_div.find('span', class_='price').text.strip(),
        'rating': float(product_div.find('div', class_='rating').get('data-rating', 0)),
    