I was trying this exercise: https://www.codecademy.com/courses/learn-python-3/projects/physics-class and as soon as I added the get_energy function at step 9 and 10, nothing was getting printed to the console anymore.
I tried putting some older functions in comments, but that wouldn’t work either, but when I comment the get_energy related things, all the others would print again.
Also the save button seems to spin for a very long time when I click it with this function being active. So maybe it’s a performance issue because it generates such a big number?
Here’s my code:
def f_to_c(f_temp) : c_temp = (f_temp - 32) * 5/9 return c_temp def c_to_f(c_temp) : f_temp = c_temp * (9/5) + 32 return f_temp def get_force(mass, acceleration) : return mass * acceleration def get_energy(mass, c = 3*10**8) : return mass * c**c train_mass = 22680 train_acceleration = 10 train_distance = 100 bomb_mass = 1 f100_in_celsius = f_to_c(100) c0_in_fahrenheit = c_to_f(0) train_force = get_force(train_mass, train_acceleration) bomb_energy = get_energy(bomb_mass) print(f100_in_celsius) print(c0_in_fahrenheit) print(train_force) print("The GE train supplies " + str(train_force) +" Newtons of force.") print("A 1kg bomb supplies " + str(bomb_energy) + " Joules.")