Saturday, April 13, 2013

Best way to do calculations on linux console

I always used shell to do all calculation stuff but using it can be sometimes can be a little tricky.

Then I came across python doing calculations on python is very very simple.

Example : 

console[1] python
Python 2.4.3 (#1, Dec 22 2011, 12:12:01)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> t1 = 32*60 +8.1
>>> t2 = 33 *60 +35.1
>>> (t2-t1)/t2
0.043174036027988687
>>>



So you just have to type python and start doing calculations.

No comments:

Post a Comment