trinome.py

Created by frederic-junier

Created on July 08, 2019

371 Bytes

Retourne les racine réelles du trinome a * x ** 2 + b *x + c


from math import sqrt

def racineTrinome(a, b, c):
    """Retourne les racine réelles du trinome a * x ** 2 + b *x + c"""
    delta = b ** 2 - 4 * a * c
    if delta > 0:
        x1 = (-b - sqrt(delta)) / (2 * a)
        x2 = (-b + sqrt(delta)) / (2 * a)
        return (x1, x2)
    elif delta < 0:
        return ()
    else:
        return (-b/(2*a),)  

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.