Skip to Main Content
Blog

Check Sides Inequality Theorem of Triangle in Python

Check Sides Inequality Theorem of Triangle in Python

Enter side x: 3
Enter side y: 4
Enter side z: 5
Satisfied
def main():
	"""
	Checks if three sides can form a triangle.
	"""

	x = int(input("Enter side x: "))
	y = int(input("Enter side y: "))
	z = int(input("Enter side z: "))

	xy = x + y
	yz = y + z
	zx = z + x

	if x > 0 and y > 0 and z > 0 and xy > z and yz > x and zx > y:
		print("Satisfied")
	else:
		print("Not Satisfied")


if __name__ == "__main__":
	main()