← Back to challenges

First Class, Second Class and Third Class Levers

PythonMediumarraysobjectsphysicsconditions

Instructions

Levers are simple machines with a rigid beam and a fulcrum. From the picture below, you can see that there are 3-types of levers: first class, second class and third class.

  1. In a first class lever, the fulcrum is situated in the middle with the effort and the load being positioned opposite of each other.
  2. In a second class lever, the fulcrum is situated in the right with the effort on the left and the load in the middle.
  3. In a third class lever, the fulcrum is situated in the left with the effort being in the middle and the load being on the right.

Given a list that contains the fulcrum "f", the effort "e", and the load "l", write a function that determines whether or not the list shows a first class lever, second class lever, or a third class lever.

Examples

determine_lever(["e", "f", "l"]) ➞ "first class lever"

determine_lever(["e", "l", "f"]) ➞ "second class lever"

determine_lever(["f", "e", "l"]) ➞ "third class lever"

Notes

A pair of scissors is a first class lever, a nutcracker is a second class lever and a broom is a third class lever.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Raucous Applause