+ 2
Help please, it's a simple question of Phyton
why this error is happening and how I would fix it? The code is for second grade equations and is working but when I write print("x1= "+x1) an error happens. If I just put print(x1) it works https://code.sololearn.com/ck5etOhJxKVi/?ref=app
6 Answers
+ 4
a =5
b =15
c =-50
começo=-b
b2=b**2
meio=(b2-4*a*c)**(1/2)
final=2*a
x1=(começo+meio)/final
x2=(começo-meio)/final
print("x1 es igual a "+str(x1))
+ 2
You cant concat numbers with strings. So make the numbers a string by str() method.
eg: print("x1="+str(x1))
+ 1
So, it comes out to be that in python, you cannot concatenate a string with a float. To solve this problem, you first need to convert x1 into a string.
+ 1
how would I write it?
+ 1
thank you bro
0
https://www.sololearn.com/Discuss/1488236/?ref=app
could you help me with this also?