(Aug-22-2017, 08:13 PM)ichabod801 Wrote: How did it not work? That's the correct way to do it, so without the error message we can't tell you what is wrong.
Sorry, this is what it says when I get to a part of the code:
Traceback (most recent call last):
File "Regla de 3 directa.py", line 10, in <module>
print("Va a ser igual a " + Xstr)
TypeError: must be str, not float
this is the code, by the way
Propor = (input("Haces regla de 3 directa o inversamente proporcional? [D/I]"))
A = int(input("Si: "))
B = int(input("Es igual a: "))
C = int(input("Entonces: "))
if Propor == "D" or "I":
if Propor == "D":
X = C * B / A
Xstr = X
str(Xstr)
print("Va a ser igual a " + Xstr)
elif Propor == "I":
X = B * A / C
Xstr = X
print("Va a ser igual a " + Xstr)
print("Programa Terminado")