A question about srt()!


Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

Strings and Console Output

Could anyone help me with this question, please?

pi = 3.14
print str(pi)
print pi 

When I run it, both of the prints give the same answer, 3.14!
I mean shouldn’t the first print be “3.14” and the second one 3.14?


no, if you do:

print "hello world"

you also get hello world, the quotation marks enclosing a string are not displayed when using print.


Thank you for your response. I understand it.


No, a str() prints only whats inside the quotes.

The quotes tell the code that it is a string.


@tejasraman thank you for your response.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.