# Code won't print last statement

#1

The very last print statement won’t print. This is Python 3 in the course: https://www.codecademy.com/courses/learn-python-3/projects/physics-class

Code:

``````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(85)

print ("""---------------------------------------------------------------------------

""")

print ("Its "+str(f100_in_Celsius)+" in Celsius")

#Celsius to Fahrenheit:

def c_to_f(c_temp):

f_temp = c_temp * (9/5) + 32

return f_temp

c0_in_fahrenheit = c_to_f(29)

print ("""---------------------------------------------------------------------------

""")

print ("Its "+str(c0_in_fahrenheit)+" in Fahrenheit")

#Train Force:

def get_force(mass, acceleration):

return mass*acceleration

train_force = get_force (train_mass, train_acceleration)

print ("""---------------------------------------------------------------------------

""")

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

#Bomb Energy:

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

return mass*c**2

bomb_energy = get_energy (bomb_mass)

print ("""---------------------------------------------------------------------------

""")

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

#Distance:

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 ("""---------------------------------------------------------------------------

""")

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

#2

That won’t print anything at all, don’t see what’s special about the last one. Something’s not quite right about the question. Did you post the wrong code?

I suggest narrowing down the problem by running less code, isolate the problematic piece of code, fix it, and then put it back with the rest.

#3

Ok thanks! I will let you know if it works

#4

Ok so it prints everything besides the last statement. Here is the exact code that I am using:

``````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(85)

print ("""---------------------------------------------------------------------------

""")

print ("Its "+str(f100_in_Celsius)+" in Celsius")

#Celsius to Fahrenheit:

def c_to_f(c_temp):

f_temp = c_temp * (9/5) + 32

return f_temp

c0_in_fahrenheit = c_to_f(29)

print ("""---------------------------------------------------------------------------

""")

print ("Its "+str(c0_in_fahrenheit)+" in Fahrenheit")

#Train Force:

def get_force(mass, acceleration):

return mass*acceleration

train_force = get_force (train_mass, train_acceleration)

print ("""---------------------------------------------------------------------------

""")

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

#Bomb Energy:

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

return mass*c**2

bomb_energy = get_energy (bomb_mass)

print ("""---------------------------------------------------------------------------

""")

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

#Distance:

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 ("""---------------------------------------------------------------------------

""")

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

#5

I look at the lesson and code it in VSC. Would me copy and pasting it right into here from VSC be messing it up?

#6

I’m rather curios what you’re doing to make copy-pasting behave that way actually…
As for whether that’s the case you should be able to tell all by yourself by looking at the code in your own post, or even pasting it back and trying to run it

#7

I got it now, it was an indentation error. Thanks!