Getting Ready for Physics Class

https://www.codecademy.com/courses/learn-python-3/projects/physics-class?action=resume_content_item

I’m taking this test and what I don’t understand is the purpose of doing this:

in part 11 of the 13 questions asked it states the following:

Define a final function called get_work that takes in mass , acceleration , and distance .

Work is defined as force multiplied by distance. First, get the force using get_force , then multiply that by distance . Return the result.

This is the answer:

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

neither force, nor distance seems to have any relationship to the final answer? I can’t wrap my head around why “force” and “distance” are needed?


You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

1 Like

You need force and distance because to find the work, you need to multiply those two values. (In physics, W = F * D).
But, since force isn’t an input, you need to use mass and acceleration to find it.
To find the force, you need to multiply the mass by the acceleration (F = M * A) Multiplying these two values will give you the force. Then, once you have the force, you multiply it by distance to find the total work.
Does that make any sense?

Essentially, what the code is doing is:

  1. Work has three inputs: Mass, Acceleration, and Distance.
  2. To find Work, you need to multiply Force by Distance.
  3. Since you don’t have Force, you need to get_force by multiplying Mass by Acceleration (calls the get_force function to multiply them).
  4. Finally, you have Force and Distance, so you can multiply those two, finding the Work. This value is returned.

Hope this helps!

Thanks I was over thinking!