Reputation: 1
Thats my code, I don't know why the program gives me that Error.. PD: I'm a beginner in this programming language.
import math
while True:
A=input("Escribe el Valor de la 1ra Variable : ")
B=input("Escribe el Valor de la 2da Variable : ")
C=input("Escribe el Valor de la 3ra Variable : ")
Ec1 = (B * -1)
Ec2 = (B ** 2 - 4 * A * C)
Ec3 = (2*A)
R = math.sqrt(Ec2)
X1 = Ec1 + R / Ec3
X2 = Ec1 - R / Ec3
print('''El Valor de Su Ecuacion Es:/n
X1 = %d
X2 = %d''' % (X1, X2))
Upvotes: 0
Views: 14158
Reputation: 11
Instead of putting input("Escribe el Valor de la 1ra Variable : ")
Put int(input("Escribe el Valor de la 1ra Variable : ")
That converts the input to an integer.
Upvotes: 1
Reputation: 59
It is failing because input()
returns a string. To convert it to an integer, you can use int(some_string)
.
Upvotes: 2