In this basic Python program, we will print the square and cube of a given number using the ** method.
Steps to solve the program
- Take a number as input.
- Print the square and cube using the ** (power) method.
- To print the square use **2 and for the cube use **3.
- Print the output.
Program :
n = 9
print("Square of number :", n**2)
print("Cube of number :", n**3)
Output :
Square of number: 81
Cube of number: 729