#!/usr/local/bin/python2.7
'''
#Learning variables in Python
File name: python_operators.py
Author: Prabhath Kota
Date: June 29, 2018
Python Version: 2.7
'''
'''
Python Arithmetic Operators: +, -, *, /, % (modulus), ** (exponent), // (Floor Division)
Python Comparison Operators: ==, !=, <> (not equals), >, <, >=, <=
Python Assignment Operators: =, +=, -=, *=, /=, %=, //=
Logical: and, or, not
Python Identity Operators: Identity operators compare the memory locations of two objects
Python Operators Precedence:
Exponentiation (raise to the power)
Multiply, divide, modulo and floor division
Addition and subtraction
Comparison operators
Equality operators
'''
a = 100
b = 200
c = 10
print '-----------------Python Arithmetic Operators-----------------'
print a+b #300
print a-b #-100
print a*b #20000
print b/a #2
print b%a #0
print b**a #....
print '-----------------Python Comparision Operators-----------------'
print a == b #False
print a>b #False
print a != b #True
print a<>b #True #Not equals to
print a>b #False
print a < b #True
print '-----------------Python Assignment Operators-----------------'
b += 100
print b
b *= 10
print b
b = 200
b %= 10
print b
print '-----------------Python Membership Operators-----------------'
print 10 in [100, 200, 10, 300]
print 111 not in [100, 200, 10, 300]
print '-----------------Python Operators Precedence-----------------'
a = 20
b = 10
c = 15
d = 5
e = 0
e = (a + b) * c / d #( 30 * 15 ) / 5
print "Value of (a + b) * c / d is ", e
e = ((a + b) * c) / d # (30 * 15 ) / 5
print "Value of ((a + b) * c) / d is ", e
e = (a + b) * (c / d); # (30) * (15/5)
print "Value of (a + b) * (c / d) is ", e
e = a + (b * c) / d; # 20 + (150/5)
print "Value of a + (b * c) / d is ", e
'''
#Learning variables in Python
File name: python_operators.py
Author: Prabhath Kota
Date: June 29, 2018
Python Version: 2.7
'''
'''
Python Arithmetic Operators: +, -, *, /, % (modulus), ** (exponent), // (Floor Division)
Python Comparison Operators: ==, !=, <> (not equals), >, <, >=, <=
Python Assignment Operators: =, +=, -=, *=, /=, %=, //=
Logical: and, or, not
Python Identity Operators: Identity operators compare the memory locations of two objects
Python Operators Precedence:
Exponentiation (raise to the power)
Multiply, divide, modulo and floor division
Addition and subtraction
Comparison operators
Equality operators
'''
a = 100
b = 200
c = 10
print '-----------------Python Arithmetic Operators-----------------'
print a+b #300
print a-b #-100
print a*b #20000
print b/a #2
print b%a #0
print b**a #....
print '-----------------Python Comparision Operators-----------------'
print a == b #False
print a>b #False
print a != b #True
print a<>b #True #Not equals to
print a>b #False
print a < b #True
print '-----------------Python Assignment Operators-----------------'
b += 100
print b
b *= 10
print b
b = 200
b %= 10
print b
print '-----------------Python Membership Operators-----------------'
print 10 in [100, 200, 10, 300]
print 111 not in [100, 200, 10, 300]
print '-----------------Python Operators Precedence-----------------'
a = 20
b = 10
c = 15
d = 5
e = 0
e = (a + b) * c / d #( 30 * 15 ) / 5
print "Value of (a + b) * c / d is ", e
e = ((a + b) * c) / d # (30 * 15 ) / 5
print "Value of ((a + b) * c) / d is ", e
e = (a + b) * (c / d); # (30) * (15/5)
print "Value of (a + b) * (c / d) is ", e
e = a + (b * c) / d; # 20 + (150/5)
print "Value of a + (b * c) / d is ", e