Arithmetic Operators: Exercises


5. Exponentiation Operator. In Python, you can use the operator ** to raise a number to a power. For example, 2**3.

Define two variables, base=3, exponent=4.

Next, raise base to the exponent power, and assign it to a third variable, result.

Finally, print c to the console.


# Define a and b. base = ___ exponent = ___ # Raise base to the exponent power. result = ___ # Print result. print(___) # Define a and b. base = 3 exponent = 4 # Raise base to the exponent power. result = base ** exponent # Print result. print(result) test_object("base") test_object("exponent") test_object("result") success_msg("Correct! ")
You can use the ** operator for exponentiation.

Previous Exercise Next Exercise