#!/usr/bin/python
#BEMDAS (Brackets, Exponents, Mul, Div, Add, SUB)
print "2 ** 2 = ", 2 ** 2
print "2 ** 2 * 2 = ", 2 ** 2 * 2
print "2 ** 2 * 2 / 2 = ", 2 ** 2 * 2 / 2
print "2 ** 2 * 2 / 2 + 2 = ", 2 ** 2 * 2 / 2 + 2
print "2 ** 2 * 2 / 2 + 2 - 2 = ", 2 ** 2 * 2 / 2 + 2 - 2
#If we need to know the remainder we use the Modulus operator %
print "The answer for 10 / 3 is = ", 10/3, "and the remainder is = ", 10 % 3
*****************************************************************************
bala@bala-laptop:~/python$ python MathOperations.py
2 ** 2 = 4
2 ** 2 * 2 = 8
2 ** 2 * 2 / 2 = 4
2 ** 2 * 2 / 2 + 2 = 6
2 ** 2 * 2 / 2 + 2 - 2 = 4
The answer for 10 / 3 is = 3 and the remainder is = 1
bala@bala-laptop:~/python$
#BEMDAS (Brackets, Exponents, Mul, Div, Add, SUB)
print "2 ** 2 = ", 2 ** 2
print "2 ** 2 * 2 = ", 2 ** 2 * 2
print "2 ** 2 * 2 / 2 = ", 2 ** 2 * 2 / 2
print "2 ** 2 * 2 / 2 + 2 = ", 2 ** 2 * 2 / 2 + 2
print "2 ** 2 * 2 / 2 + 2 - 2 = ", 2 ** 2 * 2 / 2 + 2 - 2
#If we need to know the remainder we use the Modulus operator %
print "The answer for 10 / 3 is = ", 10/3, "and the remainder is = ", 10 % 3
*****************************************************************************
bala@bala-laptop:~/python$ python MathOperations.py
2 ** 2 = 4
2 ** 2 * 2 = 8
2 ** 2 * 2 / 2 = 4
2 ** 2 * 2 / 2 + 2 = 6
2 ** 2 * 2 / 2 + 2 - 2 = 4
The answer for 10 / 3 is = 3 and the remainder is = 1
bala@bala-laptop:~/python$
No comments:
Post a Comment