Answered You can hire a professional tutor to get the answer.
#MODIFY THE TEMPLATE TO: Amend the solution to the triangle problem. #I had trouble with the code create below using if-else statements: import...
#MODIFY THE TEMPLATE TO: Amend the solution to the triangle problem.
#I had trouble with the code create below using if-else statements:
import subprocess
def triangle(n1,n2,n3):
side1 = n1 #this gets the first number from the user and stores it in a memory location called number1
side2 = n2
side3 = n3
if (side1 == side2 == side3):
result = 'equilateral'
elif (side1 == side2) or (side1 == side3) or (side2 == side3):
result = 'isosceles'
elif (side1 != side2 != side3):
result = 'scalene'
else:
result = 'a different shape'
return result
#END OF YOUR CODE
test1 = triangle(3,3,3)
test2 = triangle(3,3,2)
test3 = triangle(3,2,3)
test4 = triangle(2,3,3)
test5 = triangle(3,2,3)
test6 = triangle(0,0,0)
test7 = triangle(6,4,4)
test8 = triangle(6,4,5)
test9 = triangle(6,5,4)
test10 = triangle(6,3,3)
test11 = triangle(4,6,4)
test12 = triangle(5,6,4)
test13 = triangle(4,6,5)
test14 = triangle(3,6,3)
test15 = triangle(4,4,6)
test16 = triangle(4,5,6)
test17 = triangle(5,4,6)
test18 = triangle(3,3,6)
test19 = triangle(3,4,5)
test20 = triangle(1,2,3)
test21 = triangle(1,3,2)
test22 = triangle(3,1,2)
failed = False
if (test1 == "equilateral"):
print "(3,3,3) is equilateral, you got it RIGHT!"
else:
print "(3,3,3) is equilateral, you got: " + str(test1)
failed = True
if (test2 == "isosceles"):
print "(3,3,2) is isosceles, you got it RIGHT!"
else:
print "(3,3,2) is isosceles, you got: " + str(test2)
failed = True
if (test3 == "isosceles"):
print "(3,2,3) is isosceles, you got it RIGHT!"
else:
print "(3,2,3) is isosceles, you got: " + str(test3)
failed = True
if (test4 == "isosceles"):
print "(2,3,3) is isosceles, you got it RIGHT!"
else:
print "(2,3,3) is isosceles, you got: " + str(test4)
failed = True
if (test5 == "isosceles"):
print "(3,2,3) is isosceles, you got it RIGHT!"
else:
print "(3,2,3) is isosceles, you got: " + str(test5)
failed = True
if (test6 == "invalid"):
print "(0,0,0) is invalid, you got it RIGHT!"
else:
print "(0,0,0) is invalid, you got: " + str(test6)
failed = True
if (test7 == "isosceles"):
print "(6,4,4) is isosceles, you got it RIGHT!"
else:
print "(6,4,4) is isosceles, you got: " + str(test7)
failed = True
if (test8 == "scalene"):
print "(6,4,5) is scalene, you got it RIGHT!"
else:
print "(6,4,5) is scalene, you got: " + str(test8)
failed = True
if (test9 == "scalene"):
print "(6,5,4) is scalene, you got it RIGHT!"
else:
print "(6,5,4) is scalene, you got: " + str(test9)
failed = True
if (test10 == "invalid"):
print "(6,3,3) is invalid, you got it RIGHT!"
else:
print "(6,3,3) is invalid, you got: " + str(test10)
failed = True
if (test11 == "isosceles"):
print "(4,6,4) is isosceles, you got it RIGHT!"
else:
print "(4,6,4) is isosceles, you got: " + str(test11)
failed = True
if (test12 == "scalene"):
print "(5,6,4) is scalene, you got it RIGHT!"
else:
print "(5,6,4) is scalene, you got: " + str(test12)
failed = True
if (test13 == "scalene"):
print "(4,6,5) is scalene, you got it RIGHT!"
else:
print "(4,6,5) is scalene, you got: " + str(test13)
failed = True
if (test14 == "invalid"):
print "(3,6,3) is invalid, you got it RIGHT!"
else:
print "(3,6,3) is invalid, you got: " + str(test14)
failed = True
if (test15 == "isosceles"):
print "(4,4,6) is isosceles, you got it RIGHT!"
else:
print "(4,4,6) is isosceles, you got: " + str(test15)
failed = True
if (test16 == "scalene"):
print "(4,6,5) is scalene, you got it RIGHT!"
else:
print "(4,6,5) is scalene, you got: " + str(test16)
failed = True
if (test17 == "scalene"):
print "(5,4,6) is scalene, you got it RIGHT!"
else:
print "(5,4,6) is scalene, you got: " + str(test17)
failed = True
if (test18 == "invalid"):
print "(3,3,6) is invalid, you got it RIGHT!"
else:
print "(3,3,6) is invalid, you got: " + str(test18)
failed = True
if (test19 == "scalene"):
print "(3,4,5) is scalene, you got it RIGHT!"
else:
print "(3,4,5) is scalene, you got: " + str(test19)
failed = True
if (test20 == "invalid"):
print "(1,2,3) is invalid, you got it RIGHT!"
else:
print "(1,2,3) is invalid, you got: " + str(test20)
failed = True
if (test21 == "invalid"):
print "(1,3,2) is invalid, you got it RIGHT!"
else:
print "(1,3,2) is invalid, you got: " + str(test21)
failed = True
if (test22 == "invalid"):
print "(3,1,2) is invalid, you got it RIGHT!"
else:
print "(3,1,2) is invalid, you got: " + str(test22)
failed = True
if failed == False:
print "Your code is CORRECT!"
result = subprocess.check_output
else:
print "Please check your code, at least one test case did not pass."
result = subprocess.check_output