** 或 pow() 不支持的操作数类型:'str'和'int'

** 或 pow() 不支持的操作数类型:'str'和'int'

问题描述:

那是我的代码,我不知道为什么程序给我这个错误.. PD:我是这门编程语言的初学者.

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))

失败,因为 input() 返回一个字符串.要将其转换为整数,您可以使用 int(some_string).

It is failing because input() returns a string. To convert it to an integer, you can use int(some_string).