Created
September 23, 2023 00:26
-
-
Save danybeltran/79e62c5272d2cb65de9b23c563e476e2 to your computer and use it in GitHub Desktop.
formula general
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def cuadratica(a, b, c): | |
parte2 = math.sqrt(b**2 - 4 * a * c) | |
resultado1 = -b + parte2 | |
resultado2 = -b - parte2 | |
results = dict() | |
results["x1"] = resultado1 / (2 * a) | |
results["x2"] = resultado2 / (2 * a) | |
return results | |
results = cuadratica(1, -5, 6) | |
print("x1: {}, x2: {}".format(results.get("x1"), results.get("x2"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment