Cacao Chocolate Web Scraping with BeautifulSoup Q7

https://www.codecademy.com/paths/data-science/tracks/learn-web-scraping/modules/beautiful-soup/projects/chocolate-scraping-with-beautiful-soup

For Q7 of the project I’m having some trouble adding float() to the for loop

import codecademylib3_seaborn
from bs4 import BeautifulSoup
import requests
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

webpage_response = requests.get('https://s3.amazonaws.com/codecademy-content/courses/beautifulsoup/cacao/index.html')
webpage = webpage_response.content
soup = BeautifulSoup(webpage, 'html.parser')

rating = soup.select('.Rating')
print(rating)

ratings = []
for i in rating:
  i = i.get_text()
  ratings.append(i)

print(ratings)

I saw in another post they did it as for i in range(len(rating)) and they added the float() to their code.

Is there some reason why I’m not able to add float() to my code above?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.