Introduction Lutz(2013) states that python automatically loads the functions of the operators when function is called such as '+' performing the numeric functions, while concatenating the string values. The author discussed the polymorphism which implies that operator functions depends on the type of the object is operated on. Comparative Operators For comparison, Python uses comparative operator to evaluate the true or false statement, or execute the statement.
Simple computation For computation, Python use states operators and their functions are depends on the object and its function.
Here in this example python, uses the math operators to calculate the value of variable a, b,c.
Similarly, subtraction and multiplication function can be used to evaluate the multiplication functions.
Python does not deviate from by creating newer numeric operators but used the math convention to further the goals of computer programming. These are easy to operate and performs the functions according to object. Concatenation It joins two variable and placing into the strings format as requested in double or single quotes. The example of concatenation as:
Assignment These are assignment operators in Python and their operation depends on their functions.
In this assignment operator, the python calculated the value by x-y.
The multiplication function is performed to variable which returns with the value 99.
Division function is also operated in similar function. Python have number of very nicely defined operator to make the programming more concise and control to reduce the programming complications.
Comparison Python Compare the values of the statement and determines whether these are true or not. The determination is predicted on the numeric values. There are number of comparison operators in Python. The sample of these are:
In example 1, the comparative operator returns with the false results after computing the numeric values assigned to each variable.
In first case, Python returns with false result because two lists are different, while second true.
In example 3, Python returns with false returns because the variable a value is different. Python has comparative operator for the purpose of evaluating the validity of the values. These return with False or True value or execute the statement according to the object function.
| operators
|
Python >