Decorators in Python

Yesterday I m searching for decorators in Python, and i found it difficult to get a good tutorial for a beginner like me. Tutorials are available but it all found waste for me.

Here you can find a good tutorial for decorators, which will be useful for beginners like me.

Last i recognized stack overflow is awesome and why my majority friends are using it.

 

Advertisements

Simple Mathematics

Open a python shell. and type like this

>>> 9 *0.000001
output : 9.0000000000000002e-06
>>> 99 *0.000001
output : 9.8999999999999994e-05
>>> 111 *0.000001
output : 0.000111
>>> 999 *0.000001
output : 0.00099899999999999989

See the difference between first, second & third, fourth. First two takes floating notation.

So while  coding in any scripting language take care of this. It  may cause some simple bugs sometimes even critical.

In php we can use number_format() function to get all the outputs in decimal notation.  So there will be no mismatch in formats there by reducing the chance of creating a bug.