Previous Lesson Current Lesson Next Lesson

Question 1

Let’s create a variable called favorite_number and set it to 73:

favorite_number = 73
print(favorite_number + 1)
print(favorite_number * 2)

The sum is 74, and the product is 146. This leads to an output of:


Question 2

Let’s create variable x assigned to the string "Python"

x = "Python"
print(2 * x)

This will output:


The string is fact duplicated! In fact, if you multiply a string by an integer n, you will get a string comprised of n copies of the original string. This is an example of what we call overloading of the multiplication operator. We will learn more about overloading in a subsequent lesson. :)