Math, asked by ankuzhsharma, 4 months ago

Convert the following mathematical expression to Python
expression:
AB+vb(underroot b)

Answers

Answered by sourasghotekar123
0

Answer:

Python program for expression

Step-by-step explanation:

From the above question,

An expression is a combination of operators and operands that is interpreted to produce some other value. In any programming language, an expression is evaluated as per the precedence of its operators. So that if there is more than one operator in an expression, their precedence decides which operation will be performed first.

import math  

def findRoots(a, b, c):  

   dis_form = b * b - 4 * a * c  

   sqrt_val = math.sqrt(abs(dis_form))  

if dis_form > 0:  

       print(" real and different roots ")  

       print((-b + sqrt_val) / (2 * a))  

       print((-b - sqrt_val) / (2 * a))  

elif dis_form == 0:  

       print(" real and same roots")  

       print(-b / (2 * a))  

  else:  

       print("Complex Roots")  

       print(- b / (2 * a), " + i", sqrt_val)  

       print(- b / (2 * a), " - i", sqrt_val)  

a = int(input('Enter a:'))  

b = int(input('Enter b:'))  

c = int(input('Enter c:'))  

# If a is 0, then incorrect equation  

if a == 0:  

   print("Input correct quadratic equation")  

else:  

   findRoots(a, b, c)  

For more related question : https://brainly.in/question/314144

#SPJ1

Similar questions