Python Getting Ready for Physics Class Function

Hi, I keep getting a SyntaxError on line 34 which is the last line i wrote. I checked everything along with the instructions video and everything seems the same.

It says that “EOL while scanning string literal” for the last line of string which is str(bomb_energy) + " Joules.”).

Here is the link to the project https://www.codecademy.com/courses/learn-python-3/projects/physics-class
From question 8 to 10.

This function:

bomb_mass = 1

def get_energy(mass, c=3*108):
return mass * c
2

bomb_energy = get_energy(bomb_mass)

print("A 1kg bomb supplies " +
str(bomb_energy) + " Joules.”)

To preserve code formatting in forum posts, see [How to] Format code in posts
I think your posted code is:

bomb_mass = 1

def get_energy(mass, c=3*10**8):
    return mass * c**2

bomb_energy = get_energy(bomb_mass)

print("A 1kg bomb supplies " + str(bomb_energy) + " Joules.”)

The problem seems to be the closing quote.

# You wrote:
" Joules.”
# It should be:
" Joules."

yeah i got it fixed with exactly what u said, thanks!

1 Like