Arithmetic Operators: Exercises


3. Multiplication Operator. In Python, the operator * is used to perform scalar multiplication.

Define two variables, a=2, b=3.0.

Next, computer their product and assign it to a third variable, c.

Finally, print c to the console.


# Define a and b. a = ___ ___ = 3.0 # Assign product of a and b to new variable, c. ___ # Print c. ___ # Define a and b. a = 2 b = 3.0 # Assign product of a and b to new variable, c. c = a * b # Print c. print(c) test_object("a") test_object("b") test_object("c") success_msg("Correct! Notice that we defined b=3.0, rather than 3. This ensures that Python will interpret it as a floating point number, rather than an integer.")
You can use the * operator to multiply two numbers together.

Previous Exercise Next Exercise