Arithmetic Operators: Exercises


1. Addition Operator. In Python, the addition operator, +, is used to sum numbers together.

In the exercise below, start by defining two variables, a=5 and b=3.

Next, compute their sum and assign it to a third variable, c.

Finally, use the print() function to print c to the console.


# Define a and b. a = ___ b = ___ # Perform addition. c = ___ ___ b # Print c. print(c) # Define a and b. a = 5 b = 3 # Perform addition. c = a + b # Print c. print(c) test_object("a") test_object("b") test_object("c") success_msg("Correct! Notice that + can also be used to concatenate string variables.")
You can use the + operator to add two numbers together.

Previous Exercise Next Exercise