Now let’s look at str(), which is a little less straightforward. The str() method turns non-strings into strings!

so according to this if i do

pi = john
print str(pi)

then i should get output

but it is showing error

why is this showing error as i have converted pi into string


because when defining/declaring pi, you give it a undefined variable as value, pi should contain a float value, the value of pi to be exact.


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