human
Can you provide a code to boundary Value Analysis : Nature of Roots of a Quadratic equation and the other steps required given the following:
Boundary Value Analysis : Nature of Roots of a Quadratic equation | BVA for nature of roots of a quadratic equation.
If a = 0 , D / 2 a will yield exception Hence it is not a valid Quadratic Equation.
If D > 0 , it will be Real Roots.
If D == 0 , it will be Equal Roots.
If D < 0 , it will be Imaginary Roots.
Function to check for all testcases.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to boundary Value Analysis : Nature of Roots of a Quadratic equation and the other steps required.
 def nature_of_roots ( a , b , c ) :
	if ( a == 0 ) :
		print ( " Not ▁ a ▁ Quadratic ▁ Equation " ) ;
		return ;
	D = b * b - 4 * a * c ;
	if ( D > 0 ) :
		print ( " Real ▁ Roots " ) ;
	elif ( D == 0 ) :
		print ( " Equal ▁ Roots " ) ;
	else :
		print ( " Imaginary ▁ Roots " ) ;
def checkForAllTestCase ( ) :
	print ( " Testcase 	 a 	 b 	 c 	 Actual ▁ Output " ) ;
	print ( ) ;
	a = b = c = 0 ;
	testcase = 1 ;
	while ( testcase <= 13 ) :
		if ( testcase == 1 ) :
			a = 0 ;
			b = 50 ;
			c = 50 ;
		elif ( testcase == 2 ) :
			a = 1 ;
			b = 50 ;
			c = 50 ;
		elif ( testcase == 3 ) :
			a = 50 ;
			b = 50 ;
			c = 50 ;
		elif ( testcase == 4 ) :
			a = 99 ;
			b = 50 ;
			c = 50 ;
		elif ( testcase == 5 ) :
			a = 100 ;
			b = 50 ;
			c = 50 ;
		elif ( testcase == 6 ) :
			a = 50 ;
			b = 0 ;
			c = 50 ;
		elif ( testcase == 7 ) :
			a = 50 ;
			b = 1 ;
			c = 50 ;
		elif ( testcase == 8 ) :
			a = 50 ;
			b = 99 ;
			c = 50 ;
		elif ( testcase == 9 ) :
			a = 50 ;
			b = 100 ;
			c = 50 ;
		elif ( testcase == 10 ) :
			a = 50 ;
			b = 50 ;
			c = 0 ;
		elif ( testcase == 11 ) :
			a = 50 ;
			b = 50 ;
			c = 1 ;
		elif ( testcase == 12 ) :
			a = 50 ;
			b = 50 ;
			c = 99 ;
		elif ( testcase == 13 ) :
			a = 50 ;
			b = 50 ;
			c = 100 ;
		print ( " 	 " , testcase , " 	 " , a , " 	 " , b , " 	 " , c , " 	 " , end = " " ) ;
		nature_of_roots ( a , b , c ) ;
		print ( ) ;
		testcase += 1 ;
if __name__ == ' _ _ main _ _ ' :
	checkForAllTestCase ( ) ;