Print "The value of pi is around " + str(3.14)


#1

print "The value of pi is around " + str(3.14)

Traceback (most recent call last):
File "python", line 3, in
TypeError: cannot concatenate 'str' and 'float' objects

why does this not work ?
Replace this line with your code.


#2

The error message explains that you cannot concatenate a string with a float. Try converting the float str.(3.14) to a string when you print it out.


#3

pi= 3.14
print str(pi)


#4

For me it doesn't work in the python shell (3.5.2)
Only on the web page

In the Shell I need to write: print ("The value of pi is around ") + str(3.14)


#6