[Edu-sig] More Pythonic Precalculus (Python 2.0)

Kirby Urner pdx4d@teleport.com
Mon, 25 Sep 2000 15:29:37 -0700


At 03:18 PM 09/25/2000 -0400, David Scherer wrote:
>> In any case, the challenge before me was to accept algebraic
>> expressions as strings, for whatever reasons.
>
>How about just
>
>>>> f = "2 * x**2 - 10*x + 2"
>>>> eval(f, {'x' : 5})
>2

Now THIS is I like!

I'll upgrade to that with thanks to David Scherer.

Kirby