basic python 2.7 print method question

JC724

Weaksauce
Joined
Jan 20, 2016
Messages
118
I have been googling but haven't been able to find a answer.

If I put this in my code

value = 10
print("here is the value :",value,"\n")

This is the output

('here is the value :', 10, '\n')

why is the output not just

here is the value : 10
 
You have a few ways of appending things..

Code:
value = 10
print "here is the value : " + str(value) + "\n"

.. but mostly it has issues with your unconverted integer.
Code:
value = 10
print "here is the value : " , str(value) , "\n"
 
I have been googling but haven't been able to find a answer.

If I put this in my code

value = 10
print("here is the value :",value,"\n")

This is the output

('here is the value :', 10, '\n')

why is the output not just

here is the value : 10

Because that's not python syntax.
 
Back
Top