0

for example when i say x:9 p:3 q:2 it returns x1:(-0-0j) x2:-0-0j. thanks for the help in advanced!

import math, cmath
from math import *
from cmath import *
x = input("input x value:")
pA = input("input p value:")
qA = input("input q value:")

p = int(pA)/int(x)
q = int(qA)/int(x)

solutionA = -(int(p)/2)
solutionB = cmath.sqrt(math.pow((int(p)/2),2)-int(q))
solution1 = solutionA-solutionB
solution2 = solutionA+solutionB

print("x1: {:g}".format(solution1))
print("x2: {:g}".format(solution2))
print ("x1:",solution1)
print ("x2:",solution2)
Lukas Schulte
  • 15
  • 1
  • 5

0 Answers0