J
J
Joulence2020-06-19 23:23:38
Python
Joulence, 2020-06-19 23:23:38

How to correct code for output if\else?

https://repl.it/@Joulence/vectorsfigure
There is such code. Works + - not bad, but there is a flaw. The code determines the sides of the triangle and often prints two results, or sometimes three. How to improve, change or even rewrite the code so that it always displays one value, and not more than one, as in the picture:
5eed1e9290376932259168.png
Everything is written in if \ elif

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2020-06-19
@Joulence

Weird question. Just such a conclusion is correct. According to your definition, your triangle is both simple (3 < 4+5; 4<3+5; 5<3+4) and rectangular 25= 9+16. What should the code do in such cases?
What would output "ONLY ONE" - your definitions (not code, but not definitions!) Must be mutually exclusive. You don't.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question