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>when in doubt, add print statements</p>

<pre><code>number = input ('Please enter a number ')
print("number is %s of type %s" % (number, type(number)))
print("number is {} of type {}".format(number, type(number)))

y = number ** 2
print("y is {} of type {}".format(y, type(y)))

z = number **3
print("z is {} of type {}".format(z, type(z)))

print (y+z)
</code></pre>

<p>Output:</p>

<pre><code>python3 x.py
Please enter a number 4
number is 4 of type &lt;class 'str'&gt;
number is 4 of type &lt;class 'str'&gt;
Traceback (most recent call last):
  File "x.py", line 5, in &lt;module&gt;
    y = number ** 2
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
</code></pre>

<p>AS you can see, number is a string because in python3, <code>input</code> returns the users input as a string</p>

<p>change it to <code>int(input('Please enter a number'))</code></p>

python