[Tutor] Issue with string method: str(variable ** n)

Rafael Knuth rafael.knuth at gmail.com
Thu May 16 20:58:33 CEST 2013


Hej,

I wrote a tiny little program which I was hoping would take a number as
input, square and print it:

square = input ("Enter a number. ")
print (str(square) + " squared is " + str(square ** 2))

It seems I can't work with variables within the str() string method, and I
was wondering if anyone can help?

PS. I am using Python 3.3.0

Thank you in advance!

Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130516/48a42f67/attachment.html>


More information about the Tutor mailing list