I used the following script to try to answer this question:
def isEquilateral(x, y, z):
if x<0 or y <0 or z<0:
return False
elif x==y==z:
return True
else:
return False
It returned Private Test Cases, I don’t know if this is a software bug, or my code really have some problem. Can anyone help? Thanks.
update 01
Question as below:
Write a function isEquilateral(x, y, z) that accepts the 3 sides of a triangle as arguments. The program should return True if it is an equilateral triangle.
Examples
>>> isEquilateral(2, 4, 3)
False
>>> isEquilateral(3, 3, 3)
True
>>> isEquilateral(-3, -3, -3)
False
While I’m not impressed with their feedback system, the problem is you return True when x, y, z == 0. A simpler solution:
And an even simpler solution, which shows off the beauty of Python (thanks, F.J!) using even more chained comparisons: