Android apps to use in appium android test examples

Breaking

Thursday, May 17, 2018

Python Operators


Operators are used to perform Arithmetic Python Operators
Python Operators

Operators are used to perform Arithmetic, Comparison, together with Logical Operations...

Important categories of operators inward Python:

1) Arithmetic Operators
2) Comparison (Relational) Operators
3) Assignment Operators
4) Logical Operators
5) Identity Operators
6) Bitwise Operators
--------------------------------
1) Python Arithmetic Operators

i) + Addition (Example: ten + 20) = 30
ii) - Subtraction (Example: ten - 20) = -10
iii) * Multiplication (Example: ten * 20) = 200
iv) / Division (Example: 20/10) = 2
v) % Modulus (Example: xx % 10) = 0
vi) ** Exponent (Example: ten ** 20) = 
--------------------------------
Examples:

a=10;
b=20;
c=3;

print (a+b);
print (a-b);
print (a*b);
print (a/c);
print (b%a);
print (a**c);
print (a//c);

Output:
30
-10
200
3.3333333333333335
0
1000
3
--------------------------------
2) Python Comparison (Relational) Operators

i) ==
ii) !=
iii) >
iv) <
v) >=
vi) <=
-------------------
Examples:
a=10;
b=20;

print (a == b);
print (a != b);
print (a > b);
print (a < b);
print (a >= b);
print (a <= b);

Output:
False
True
False
True
False
True
--------------------------------
3) Python Assignment Operators

i) = Equal to
ii) += Add And 
iii) -= Subtract And
iv) *= Multiply And
v) /= Divide And
vi) %= Modula And
vii) **= Exponent And
viii) //= Floor Division And

Examples:

a=10;
b=3;
print (a);
print (b);

a += b;
print (a);

a -=b;
print (a);

a *=b;
print (a);

a /=b;
print (a);

a **=b;
print (a);

a //=b;
print (a);

Output:
10
3
13
10
30
10.0
1000.0
333.0
--------------------------------
4) Python Logical Operators

i) together with (Loical And)
ii) or (Loical Or)
iii) Not (Loical Not)

Examples:
x='true';
y='false';

print (x together with y); # false

print (x or y); # true

print (not x); # false
--------------------------------
5) Python Identity Operators

i) is
ii) is not

Examples:

x1 = 5;
y1 = 5;

print (x1 is non y1); # false

print (x1 is y1); # true
--------------------------------
Also Read:

1) In Which sequence should We acquire Python?

2) Introduction to Python

3) Download & Install Python


4) Variables together with Data Types inward Python

Sumber http://www.gcreddy.com/

1 comment:

  1. I like your blog, I read this blog please update more content on hacking, further check it once at python online course

    ReplyDelete