I came across an exercise in "Think Python", and I couldn’t figure out how to do it.
The exercise:
- Write a function named is_triangle that takes three integers as arguments, and that prints either “Yes” or “No,” depending on whether you can or cannot form a triangle from sticks with the given lengths.
And of course:
If any of the three lengths is greater than the sum of the other two, then you cannot form a triangle. Otherwise, you can3.
There are plenty of ways to do this. Here is one: