New to Python but trying to print text and a value

I’m totally new to Python and scripting, but using the Blender game engine, I’m trying to print a string of text followed by a value derived from an object’s roation, like this:

Rot X = .6789, where “Rot X =” is in the script and the .6789 is derived from the actual rotation.

I can print the values OK, but when I try to add the text (in quotes above) I get an error.

The print line is this:

print ‘Rot X =’ (rotx)

The value is working fine, the only problem is when I try to add my text after the print command I get an error pointing to the second ’ after the = sign.

To print a combination of strings, you would need a + sign to join them, like this:

print "first string, " + “second string”

But in your case, the two parts that you want to join into a string are of different types: the first part is a string, the second a float. You will need to convert the second part into a string before it will work. All in all, you will need this:

print ('Rot X = ’ + str(rotx))