When it comes to scripting, math operators play the main role. In this tutorial, we will look into the main math symbols which you can use in python.
Following are the main arithmetic operators which can be used in python.
= Assignment Operator
Let's look at few examples.
print("Single Operation:", 3 + 5)
print("Multiple Mixed Operations", 3 + 5 - 3 - 3 )
print("True or False", 3 == 3)
print("Find Modulo", 5 % 3)
Python Integer and Float division
For pyton integer division we use
// and float division, we use
print(4//3) would output 1
print(4/3) would output 1.3333333...
Variable(https://en.wikipedia.org/wiki/Variable)are used to store values. You can assign a value to a varibale using the
string values are assigned using quotes.
name = "scripty"
interger values are assigned directly without quotes.
count = 20
length = 5.2
Multiple variable Assignation
You can assign values to variables in a single statement as shown below.
x, y, z = 1, 5.4, "scripty"
Also, you can assign a single value to multiple variables as shown below.
x, y, z = 45
it assigns 45 to x, y and z.