What is the code to ask a user to input a number and print the square and cube of that number in python 3.5?
<p>I'm using Python 3.5.2 and have been asked to write a small program to ask a user to enter a number and the program will then print out the square and the cube of the number entered. This is the code I've written so far:</p>

<pre><code> number = input ('Please enter a number ')
 y = (number)**2
 z = (number)**3
 print (y+z)
</code></pre>

<p>and when I run it I get the following error message:</p>

<pre><code>TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
</code></pre>

<p>What is the correct code to get this to work?</p>

<p>The error is quite self-explanatory :</p>

<pre><code>TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
</code></pre>

<p>Basically <code>(number)</code>is a string while <code>2</code>is an integer. What you need to do is convert <code>number</code> from <code>str</code> to <code>int</code>.
Try this :</p>

<pre><code>y = int(number) ** 2
z = int(number) ** 3
print(y+z)
</code></pre>

<p>This should do the trick.</p>

python