In the project we are supposed to get the sentences for the “Rushmore” presidents in order to create word embeddings. In question 14, we are tasked with sending a list to the get_presidents_sentences() function. I keep getting an error “AttributeError: ‘list’ object has no attribute ‘lower’” If I loop through the each president and append it to ‘rushmore_prez_sentences’, I get a new error for the question 15. It appears that the provided script get_presidents_sentences() is NOT handling lists as the question states. I’m kind of lost at the point. Any help would be appreciated.
The only way that I have found to get past the error is to do this:
wash_sent = get_president_sentences('washington') jeff_sent = get_president_sentences('jefferson') linc_sent = get_president_sentences('lincoln') teddy_sent = get_president_sentences('theodore-roosevelt') rushmore_prez_sentences = wash_sent + jeff_sent + linc_sent + teddy_sent
Trying to send a list into “get_president_sentences” always gets an error for me. This work around solved my problem.
It seems that it is already corrected. I have not had any problems with tasks 14 and 15
I ran into the same error plus occasionally other bugs in this project. Like when I print a section of my code, sometimes it worked, sometimes it didn’t.