Hi! I just got back to learning a bit of python and well, I’m stuck at the project Physics-Class.
Specifically on step #9, I am having issues with getting the following code to work:
def get_energy(mass, c = 3*10**8): return mass ** c bomb_energy = get_energy(bomb_mass) print(bomb_energy)
The steps in question:
Define a function called get_energy that takes in mass and c .
c is a constant that is usually set to the speed of light, which is roughly 3 x 10^8. Set c to have a default value of 3*10**8 .
get_energy should return mass multiplied by c squared.
Test get_energy by using it on bomb_mass , with the default value of c . Save the result to a variable called bomb_energy .
In the console it always returns 1 when printing bomb_energy while it should print 90000000000000000
What is it that I’m doing wrong, it feels like I’m just staring at a wall constantly at the moment.
I have a feeling that its going wrong at the default value of the parameter in the function get_energy.