[Tutor] eval func with floating...
simulacrx
simulacrx at gmail.com
Tue Aug 16 09:32:40 CEST 2011
hi;
-----------------------
check=(1,2,3,4,5,6,7,8,9,"/","*","-","+","(",")","[","]")
while True:
a=raw_input("type your query : \n")
c=set(a).intersection(set(check))
if c:
print *eval("float(%s)"%a)*
else:
print "error! please use -defined operators-!"
-----------------------------
this script works.. but if i type
15/8
it returns 1.. no floatin'.. i must fix this? can anyone help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110816/1bb5d4f2/attachment.html>
More information about the Tutor
mailing list