Operators allow you to perform mathematical and syntactical processes on your data. Follow along with the code below to learn how to conduct these operations on variables.
In this section, you will learn how to:
Operators perform mathematical operations when applied to numeric variables or numerals. Copy the following code on the left in your IDE to execute the process shown in the image on the right.
five = 5
six = 6
print(five + six) #(Addition)
print (five*six) #(Multiplication)
print(five/six) #(Division)
print(five-six) #(Subtraction)
print (five%six) #(Modulo - returns the remain of a division operation)
print (five**six) #(Exponent)
Operators perform syntactical edits when applied to text variables or text. Copy the following code on the left in your IDE to execute the process shown in the image on the right.
name = "Jorge"
print(name*4)
name2 = "Jason"
print (name + " " + name2)