• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

Sign in to follow this  
Followers 0

[Python] Fórmula Resolvente

1 post in this topic

import math
def resolvente(a, b, c):
root = (b*b)-(4*a*c)
if root < 0:
	return [] # e' impossi'vel calcular raizes de nu'meros negativos
total = []
return total

# Teste:
a = 1
b = -1
c = -30
print resolvente(a, b, c)

Output: [-5.0, 6.0]


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0