i was writing the following code:
def form_triangle(num1,num2,num3):
success="Triangle can be formed"
failure="Triangle can't be formed"
if(num1 < num2 + num3):
if(num2 < num1 + num3):
if(num3 < num1 + num2):
return success
else:
return failure
num1=3
num2=3
num3=5
result = form_triangle(num1, num2, num3)
print(result)
but the problem is this code is unable to pass all the test cases. for instance, if num1, num2, num3 have values 1, 2, 3 respectively, then the expected output should be N/A but my output is None. so, what changes should i have to made in my code to have the expected output.
Aucun commentaire:
Enregistrer un commentaire