 # I cannot find the error, I keep getting EOF errors as well as a syntax error!

#So below is my code, however I cannot seem to find the issues! It throws error codes at “def get_energy(mass…”

``````train_mass = 22680
train_acceleration = 10
train_distance = 100
bomb_mass = 1

#Fahrenheit to Celsius
def f_to_c(f_temp):
c_temp = (f_temp - 32) * 5/9
return c_temp
f100_in_celsius = f_to_c(100)
print(f100_in_celsius)

#Celsius to Fahrenheit
def c_to_f(c_temp):
return c_temp * (9/5) + 32

c0_in_fahrenheit = c_to_f(0)
print(c0_in_fahrenheit)

#Force Equation
def get_force(mass, acceleration):
return mass * acceleration

train_force = get_force(train_mass, train_acceleration)

print("The GE train supplies " + str(train_force) + " Newtons of force."

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

bomb_energy = get_energy(bomb_mass)

print(bomb_energy)

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

def get_work(mass, acceleration, distance):
force = get_force(mass, acceleration)
return force * distance

train_work = get_work(train_mass, train_acceleration, train_distance)

print("The GE train does" + str(train_work) + " Joules of work over" + str(train_distance) + " meters.")
``````

you may want to check the syntax you wrote. Were there any mistakes? In terms of spelling or indentation.

What is mass x c2 ?

Hi,
You might want to cast your eye over the line just before where the error message is pointing to…
Also, as estforesta to says;
c2 is going to give you a problem as it’s not been assigned anything,
I assume it’s supposed to be c-squared, so you’ll have to look at alternate way of doing that.

Other than that, assuming your indentation is correct (it doesn’t look formatted correctly on here), with those two things altered I got your code running fine.
Feel free to ask if you’re still not sure.

1 Like

Hi there, welcome to the forums.

You’ll notice I’ve edited your post to correctly format your code. Indentation is critical in Python, but the forum will remove extra spaces unless you tell it not to. There’s instructions here on how to correctly format your code when posting. You haven’t closed the parentheses for your call to `print()`. The queries around what appeared to be a variable `c2` are due to the lack of correct formatting, since the forum will interpret a non-code ** as an indicator to make the text bold.

Also, the code isn’t returning anything as there are no parentheses after the return. That lesson gave me a hard time too -Chuck