operators as variables

macc_200 macc_200 at yahoo.co.uk
Sat Dec 6 12:43:05 EST 2008


Hi,
just starting programming and have an elementary question after playing around with lists but cannot find the answer with googling.
I have a list of variables and I would like some of those variables to be integers and some to be operators so the list would look something like [5 * 4 - 4 + 6] and then be able to evaluate the result (i.e. get 10).  How do you make the interpreter see the operator as that instead of a string and just echo the list back to me.
thanks,
Andy
(and suggestions for a decent Python book would be appreciated)



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081206/1f097084/attachment-0001.html>


More information about the Python-list mailing list