+ 1
There are four test outcomes for this python . I have all but one.
*** edit*** all test are coming back correct but one, so don’t think a*2 is the issue. Given 3 sides of a triangle. What is wrong here? side1 = int(input()) side2 = int(input()) side3 = int(input()) x= (side1*2 + side2*2) if x > side3*2: print ("Right-angled") if x <= side3*2: print ("Not right-angled") Thanks
2 Respostas
+ 4
Leslie LaCroix ,
there are some issues that should be reworked:
....
x= (side1*2 + side2*2) # we have to calculate the square of each side, this needs to be done with '**' not '*'
if x > side3**2: # the same issue like the line above. also the comparison operator has to be '==' not '>'
print ("Right-angled")
else: # we don't need to specify this case, so we can use 'else' instead of 'if' (already corrected)
print ("Not right-angled")
happy coding
+ 4
Also there is diference between a*2 and a²(a*a)
Check this to see how to calculate if triangle is right angle
https://www.bbc.co.uk/bitesize/guides/zq9sgdm/revision/4