Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

Interested in buying ad space on this blog?
You can, on BuySellAds.com

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

You searched for keyword:calculator
 

found 0 photos and 3 blogs in and 0 blog comments in 0.00 seconds



 

Blogs

  Google PageRank matrix calculator (graphically) - 19th of May 2004

Some time ago I wrote about the Google PageRank algorithm in Python. It's a matrix algorithm for calculating the PageRank values for every page in a web. All you have to do is define which pages links to which and the algorithm calculates the PageRanks for every page for you.

  Google as calculator - 31st of August 2003

This is cool: You can now use Google as a calculator.

  Calculator in Python for dummies - 17th of December 2007

I need a mini calculator in my web app so that people can enter basic mathematical expressions instead of having to work it out themselfs and then enter the result in the input box. I want them to be able to enter "3*2" or "110/3" without having to do the math first. I want this to work like a pocket calculator such that 110/3 returns a 36.6666666667 and not 36 like pure Python arithmetic would. Here's the solution which works but works like Python:

 def safe_eval(expr, symbols={}):
    return eval(expr, dict(__builtins__=None), symbols)

 def calc(expr):
    return safe_eval(expr, vars(math))

 assert calc('3*2')==6
 assert calc('12.12 + 3.75 - 10*0.5')==10.87
 assert calc('110/3')==36