Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Operadores aritmeticos
- #Crea la función cuadradica
- from math import sqrt # importa libreria sqrt(raiz cuadrada) de el metodo math
- a = 20 #variable de tipo numerico
- b = -25 #variable de tipo numerico
- c = 5 #variable de tipo numerico
- determinante = b**2-4*a*c #declaración de variable
- if determinante < 0: # condicional if si el total determinante debe ser menor que 0
- print("No existen soluciones reales. ")
- else: #Condicion sino
- x1 = -b+sqrt(b**2-4*a*c)/(2*a) #variable 1
- x2 = -b-sqrt(b**2-4*a*c)/(2*a) #variable 2
- print("Solución a la ecuación. ")
- print("Solución x1: ",x1) #imprime la solucion
- print("Solución x2: ",x2) #imprime la solucion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement