String operations

hi, i keep getting an error when i intend to submit my answered question .
below is my code for the question

facebook = “facebook’s rating is”
fb_rating = 3.5
fb_rating_str = str(3.5)
fb = ('facebook’s rating is ’ + ‘3.5’)
print (fb)

It’s tough to say without a screenshot of the error you’re running into, but I’d venture to say that it’s because you’re using single quotation marks to wrap facebook's rating is

Because you’re using single quotations to indicate a string, Python is reading the apostrophe in facebook's as a closing quotation mark. In other works, Python is reading it like this:

facebook s rating is + 3.5’

There’s an open string at the end. Try wrapping your strings in double quotations instead "facebook's rating is"

I am getting the same error. even when i put the answer in.

1 Like

Hi @shem.rodger,

Can you please send us the code you have used?


Hi, thanks for the message.

I was using the answer code in the end which matched my code. It wasn’t working yesterday but after re-running today the code worked.

Thanks Shem

1 Like