Continuar = 1 def valorX (valorA, valorB, delta): x1 = (
![continuar = 1
def valorX (valorA, valorB, delta):
x1 = (-1 * valorB + delta) / (2*valorA)
x2 = (-1 * valorB - delta) / (2*valorA)
x = [x1,x2]
return x
print("Bem vindo ao algoritmo de calcular raizes do segundo grau")
while continuar == 1:
valorA = float(input("Coloque o valor de A "))
valorB = float(input("Coloque o valor de B "))
valorC = float(input("Coloque o valor de C "))
delta = (valorB*valorB) - 4*valorC*valorA
print("The delta value is", delta)
if delta > 0:
delta = delta ** 0.5
print("the roots of the equation are:",max (valorX(valorA, valorB, delta)),"e", min (valorX(valorA, valorB, delta)))
elif delta == 0:
delta = delta ** 0.5
print("The roots of the equation are the same, ou seja:", min(valorX(valorA, valorB, delta)))
else:
print("Therefore, there is no real root of the equation")
continuar = int(input("Digite 1 se deseja continuar, If not, digite 2: "))](https://image.cdn2.seaart.me/2024-04-21/coile1de878c73dt0djg/160d4566df726f5d7010676d4d464abbac0cc480_high.webp)
Generation Data
Enregistrements
Prompts
Copier les Paramètres
continuar = 1
def valorX (valorA
,
valorB
,
delta):
x1 = (-1 * valorB + delta) / (2*valorA)
x2 = (-1 * valorB - delta) / (2*valorA)
x = [x1
,
x2]
return x
print("Bem vindo ao algoritmo de calcular raizes do segundo grau")
while continuar == 1:
valorA = float(input("Coloque o valor de A "))
valorB = float(input("Coloque o valor de B "))
valorC = float(input("Coloque o valor de C "))
delta = (valorB*valorB) - 4*valorC*valorA
print("The delta value is"
,
delta)
if delta > 0:
delta = delta ** 0
.
5
print("the roots of the equation are:"
,
max (valorX(valorA
,
valorB
,
delta))
,
"e"
,
min (valorX(valorA
,
valorB
,
delta)))
elif delta == 0:
delta = delta ** 0
.
5
print("The roots of the equation are the same
,
ou seja:"
,
min(valorX(valorA
,
valorB
,
delta)))
else:
print("Therefore
,
there is no real root of the equation")
continuar = int(input("Digite 1 se deseja continuar
,
If not
,
digite 2: "))
Info
Checkpoint & LoRA

Checkpoint
epiCRealism
#Science-fiction
#Personnages épiques
0 commentaire(s)
0
0
0