Considering just basic calculator with eval it could be possible search
eval string if it only contains digits, parenthensis and operators.
Assuring no letter (maybe except e for expotential) and special
characters this calculator should be quite safe.
But I give no any warranty for such security
Thanks, Chris (and others), for the comprehensive answer (as usual). I
got interesting insights into Python's inner workings. Of course, when
everything is an object, everything has parents and other relatives, so
by traversing that tree in the right way one can make one's way all the
way to t
On Tue, Jan 21, 2020 at 4:59 PM wrote:
>
> On Mon, 20 Jan 2020 06:43:41 +1100
> Chris Angelico wrote:
>
> > On Mon, Jan 20, 2020 at 4:43 AM wrote:
> > > It works, but is it safe?
> >
> > As such? No.
>
> That's what many people have said, and I believe them. But just from a
> point of technical
On Mon, 20 Jan 2020 06:43:41 +1100
Chris Angelico wrote:
> On Mon, Jan 20, 2020 at 4:43 AM wrote:
> > It works, but is it safe?
>
> As such? No.
That's what many people have said, and I believe them. But just from a
point of technical understanding: If I start with empty global and
local dic
> On 19. Jan 2020, at 19:35, mus...@posteo.org wrote:
>
> Is it actually possible to build a "sandbox" around eval, permitting it
> only to do some arithmetic and use some math functions, but no
> filesystem acces or module imports?
>
> I have an application that loads calculation recipes (a f
On 2020-01-19, Jon Ribbens via Python-list wrote:
> On 2020-01-19, mus...@posteo.org wrote:
>> Is it actually possible to build a "sandbox" around eval [...]
>>
>> [...]
>>
>> It works, but is it safe?
>
> No, not even slightly. If you want to do this you need to write your
> own interpreter tha
On Mon, Jan 20, 2020 at 4:43 AM wrote:
>
> Is it actually possible to build a "sandbox" around eval, permitting it
> only to do some arithmetic and use some math functions, but no
> filesystem acces or module imports?
>
> I have an application that loads calculation recipes (a few lines of
> varia
On 2020-01-19, mus...@posteo.org wrote:
> Is it actually possible to build a "sandbox" around eval, permitting it
> only to do some arithmetic and use some math functions, but no
> filesystem acces or module imports?
>
> I have an application that loads calculation recipes (a few lines of
> variab
On Sun, 19 Jan 2020 at 17:45, wrote:
>
> Is it actually possible to build a "sandbox" around eval, permitting it
> only to do some arithmetic and use some math functions, but no
> filesystem acces or module imports?
No. This has been tried before, and it simply isn't safe in the face
of malicious
Is it actually possible to build a "sandbox" around eval, permitting it
only to do some arithmetic and use some math functions, but no
filesystem acces or module imports?
I have an application that loads calculation recipes (a few lines of
variable assignments and arithmetic) from a database.
ex
On Fri, Jan 17, 2020 at 9:17 AM Python wrote:
>
> Le 16/01/2020 à 11:56, samna...@gmail.com a écrit :
> > On Wednesday, 15 January 2020 17:09:56 UTC, Python wrote:
> >> Le 15/01/2020 à 16:34, andersh...@gmail.com a écrit :
> >>> Thanks!
> >>
> >> Do not try it, though, with a expression such as
>
Le 16/01/2020 à 11:56, samna...@gmail.com a écrit :
On Wednesday, 15 January 2020 17:09:56 UTC, Python wrote:
Le 15/01/2020 à 16:34, andersh...@gmail.com a écrit :
Thanks!
Do not try it, though, with a expression such as
import os; os.system('rm -rf ~/*').
If you want something safer, http
On Wednesday, 15 January 2020 17:09:56 UTC, Python wrote:
> Le 15/01/2020 à 16:34, andersh...@gmail.com a écrit :
> > Thanks!
>
> Do not try it, though, with a expression such as
> import os; os.system('rm -rf ~/*').
If you want something safer, https://github.com/pydata/numexpr has an
expressi
Le 15/01/2020 à 16:34, andersh...@gmail.com a écrit :
Thanks!
Do not try it, though, with a expression such as
import os; os.system('rm -rf ~/*').
--
https://mail.python.org/mailman/listinfo/python-list
Thanks!
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, 15 January 2020 15:16:45 UTC, ander...@gmail.com wrote:
> Hey!
> I’m trying to implement a calculator that converts a string; for excample
> «3+98*4», to a number. Is there a module or command that I can use to
> automate this? It’s literal hell making it
Hey!
I’m trying to implement a calculator that converts a string; for excample
«3+98*4», to a number. Is there a module or command that I can use to automate
this? It’s literal hell making it from scratch.
-Anders (pycharm)
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Dec 7, 2019 at 11:21 PM ferzan saglam wrote:
>
> Hi People, I am working on a simple calculator which uses operands (+-*/).
> The program allows me to choose an operand and enter the first two values,
> but when it gets to doing the maths, it gives me an error on
> &qu
Hi People, I am working on a simple calculator which uses operands (+-*/).
The program allows me to choose an operand and enter the first two values, but
when it gets to doing the maths, it gives me an error on
"console.log ("The result is ", res);" under the + operan
To see output you should use function that prints to the output, for
example print(). You also do not calculate correctly the tax and tip, it is
percentage from the meal cost, so the tax to be added to the total meal
cost is meal * tax / 100.
meal = 44.50
tax = 6.75
tip = 15.0
tax_amount = meal *
Cai Gengyang wrote:
So, I’m on section (3. The Tip) …
Instructions
1.
Set the variable tip to decimal value of 15% on line 5.
This was my input:
You’re almost there! Assign the tip variable on line 5.
meal = 44.50
tax = 6.75 / 100
tip = 15.0
But, when I tried to run the program, I don’t get a
So, I’m on section (3. The Tip) …
Instructions
1.
Set the variable tip to decimal value of 15% on line 5.
This was my input:
You’re almost there! Assign the tip variable on line 5.
meal = 44.50
tax = 6.75 / 100
tip = 15.0
But, when I tried to run the program, I don’t get any output at all. Nada
On Sat, 20 May 2017 11:42 am, gars...@gmail.com wrote:
> m using Python 3.4.2
> This is my code:
Please read this first:
http://sscce.org/
And then indent the "calc" method so that it is part of the class:
> def calc(self, display):
> try:
> display.set(eval(display.get()))
> e
x27;, 'arial 20 bold')
self.pack(expand=YES, fill=BOTH)
self.master.title('Calculator')
display= StringVar()
Entry(self, relief=RIDGE,
textvariable=display, justify='right', b
elf.pack(expand=YES, fill=BOTH)
self.master.title('Calculator')
display= StringVar()
Entry(self, relief=RIDGE,
textvariable=display, justify='right', bd=30, bg="powder
blue").pack(side=TOP, expand=YES,
Τη Κυριακή, 9 Οκτωβρίου 2016 - 11:55:54 μ.μ. UTC+3, ο χρήστης
chrischr...@gmail.com έγραψε:
> any idea how to calculator rasters images ?like
> ((raster1+raster2)*(raster4*9)}
> for example.
> maybe is easy that question but i dont work again with raster and python
> i have g
Am 09.10.16 um 22:55 schrieb chrischris201...@gmail.com:
any idea how to calculator rasters images ?like ((raster1+raster2)*(raster4*9)}
for example.
maybe is easy that question but i dont work again with raster and python
i have gdal,numpy,scipy,pygeoprocesing and more
With PIL you can read an
any idea how to calculator rasters images ?like ((raster1+raster2)*(raster4*9)}
for example.
maybe is easy that question but i dont work again with raster and python
i have gdal,numpy,scipy,pygeoprocesing and more
--
https://mail.python.org/mailman/listinfo/python-list
orter, but less educationnal of course...
2 lines? Love it!
That's not really implementing a calculator. It's just feeding the input
to Python to execute immediately. I can reduce it to zero lines: start
Python so that the >>> prompt appears. Then type in:
>>> 2
Op 01-07-16 om 15:52 schreef Steven D'Aprano:
> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and no
>> try/except block is need
DFS wrote:
>
> 2 lines? Love it!
>
> But apparently eval==evil.
>
> http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
>
> I bet you get hammered about it here on clp.
It was a software to be deploy, it was just for educational purpose.
--
Pierre-Alain Dorange
Steven D'Aprano writes:
> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and no
>> try/except block is needed to work around the
> On Jul 1, 2016, at 6:52 AM, Steven D'Aprano wrote:
>
>> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and no
>> try/except
On Fri, 01 Jul 2016 23:52:45 +1000, Steven D'Aprano wrote:
> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and
>> no try/excep
On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
> For my BASIC interpreter, each line of BASIC is broken this way into
> tokens.
[...]
> By using * to unpack the split line, my program no longer crashes and no
> try/except block is needed to work around the crash. A later line of code
> wil
Christopher Reimer writes:
>> On Jul 1, 2016, at 5:46 AM, Jussi Piitulainen wrote:
>>
>> Christopher Reimer writes:
>>
>>> For my BASIC interpreter, each line of BASIC is broken this way into
>>> tokens.
>>>
>>> line_number, keyword, *expression = line.split(' ', 2)
>>>
>>> For a line like 10
> On Jul 1, 2016, at 5:46 AM, Jussi Piitulainen
> wrote:
>
> Christopher Reimer writes:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
>>
>> line_number, keyword, *expression = line.split(' ', 2)
>>
>> For a line like 10 PRINT "HELLO, WORLD!", this works
Chris Warrick wrote:
> > More reduced :
> > --
> > u=raw_input('Enter calculation:")
> > print eval(u)
> > --
> > works and compute :
> > 1+2+3+4-1+4*2
> > 2+3.0/2-0.5
> >
> > Perform better and shorter, but less educationnal of cour
Christopher Reimer writes:
> For my BASIC interpreter, each line of BASIC is broken this way into
> tokens.
>
> line_number, keyword, *expression = line.split(' ', 2)
>
> For a line like 10 PRINT "HELLO, WORLD!", this works as expected.
>
> For a line like 20 END, which doesn't have a third elemen
his:
>
>n1, op, n2 = ui.split()
>
> It's not only compact, it also crashes if there are more elements than
> expected, and I want it to crash when that happens. Or rather, I prefer
> a crash to silence when input is bad.
>
> For the calculator, it may be better t
On 1 July 2016 at 11:34, Pierre-Alain Dorange
wrote:
> DFS wrote:
>
>> Here's a related program that doesn't require you to tell it what type
>> of operation to perform. Just enter 'num1 operator num2' and hit Enter,
>> and it will parse the entry and do the math.
>>
>> -
DFS wrote:
> Here's a related program that doesn't require you to tell it what type
> of operation to perform. Just enter 'num1 operator num2' and hit Enter,
> and it will parse the entry and do the math.
>
> ---
> ui=raw_input('Enter calculation to p
nswer is"+ result)
> elif user_input=="subtract":
> num1=float(input("Enter a number"))
> num2=float(input("Enter another number"))
> result=str(num1-num2)
> print("The answer is"
#x27;/':c=n1/n2
> print(ui+' = '+str(c))
> ---
I use multiple assignment a lot, like this:
n1, op, n2 = ui.split()
It's not only compact, it also crashes if there are more elements than
expected, and I want it to crash when th
f user_input=="subtract":
> num1=float(input("Enter a number"))
> num2=float(input("Enter another number"))
> result=str(num1-num2)
> print("The answer is"+result)
>
> Two questions:
> 1.
num2=float(input("Enter another number"))
result=str(num1-num2)
print("The answer is"+result)
Two questions:
1. Why do I need to put ' ' around the words add, subtract, multiply, quit,
etc. when it is already in quotes in p
Hi Ryan, and welcome!
On Tuesday 02 February 2016 06:30, Ryan Young wrote:
> I am new to Python but have known Java for a few years now. With python,
> so far, so good! I created a simple calculator to calculate the total cost
> of a meal. My variables were tip tax total and order. I am
Hi Ryan,
On Mon, Feb 1, 2016 at 1:30 PM, Ryan Young wrote:
> I am new to Python but have known Java for a few years now. With python, so
> far, so good! I created a simple calculator to calculate the total cost of
> a meal. My variables were tip tax total and order. I am confused about
I am new to Python but have known Java for a few years now. With python, so
far, so good! I created a simple calculator to calculate the total cost of
a meal. My variables were tip tax total and order. I am confused about how
to put in a new 'order' because when i reset the order var
On Monday, February 3, 2014 5:16:44 AM UTC+8, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the
> program, see what i mean by just running it , can someone help me fix this
>
>
>
> def Addition():
>
> print('Addition: What are two your numbers?
Joshua Landau wrote:
> On 5 February 2014 02:22, Dan Sommers wrote:
>
>> On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote:
>>
>> > In article ,
>> > David Hutto wrote:
>> >
>> >> Can anyone point out how using an int as a var is possible
>> >
>> > one = 42
>> >
>> > (ducking and running)
>>
On 5 February 2014 02:22, Dan Sommers wrote:
> On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote:
>
> > In article ,
> > David Hutto wrote:
> >
> >> Can anyone point out how using an int as a var is possible
> >
> > one = 42
> >
> > (ducking and running)
>
> int = 42
>
> (ducking lower and ru
On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote:
> In article ,
> David Hutto wrote:
>
>> Can anyone point out how using an int as a var is possible
>
> one = 42
>
> (ducking and running)
int = 42
(ducking lower and running faster)
--
https://mail.python.org/mailman/listinfo/python-lis
On Wed, Feb 5, 2014 at 11:53 AM, Roy Smith wrote:
> In article ,
> David Hutto wrote:
>
>> Can anyone point out how using an int as a var is possible
>
> one = 42
>
> (ducking and running)
In theory, there might be a Unicode character that's valid as an
identifier, but gets converted into U+003
In article ,
David Hutto wrote:
> Can anyone point out how using an int as a var is possible
one = 42
(ducking and running)
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the
> program, see what i mean by just running it , can someone help me fix this
>
>
>
> def Addition():
>
> print('Addition: What are two your numbers?
Missed that it's already pointed out, was looking at the google groups
combined email.
On Tue, Feb 4, 2014 at 10:43 AM, David Hutto wrote:
> On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> > Hey Guys i Need Help , When i run this program i get the 'None' Under
> the program
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under the
> program, see what i mean by just running it , can someone help me fix this
>
>
>
> def Addition():
>
> print('Addition: What are two your numbers?
On Mon, 03 Feb 2014 10:25:37 -0800, Charlie Winn wrote:
> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64
> bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for
> more information.
RESTART
=
the code
being run is structurally similar to what was posted, it prints None
because the calculator functions print their result instead of returning
it, and then the main function also prints the return value from the
calculator functions, which is None. The print should be in one place or
the ot
On 02/03/2014 10:04 AM, Charlie Winn wrote:
On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
...
Sorry, but in fact you did *not* run this program as you claim. It's
full of syntax errors. Any attempt to run it will display syntax errors
immediately, and never actually run.
On Mon, 03 Feb 2014 10:04:35 -0800, Charlie Winn wrote:
> excuse me but don't be so *** rude , i did run this program and it
> did run correctly
Charlie, you may have run *some* program, but it wasn't the program you
posted here. And if it ran correctly, why are you asking for help?
The co
On Monday, February 3, 2014 6:17:44 PM UTC, Joel Goldstick wrote:
> On Feb 3, 2014 1:05 PM, "Charlie Winn" wrote:
>
> >
>
> > On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
>
> > > On 02/02/2014 01:16 PM, Charlie Winn wrote:
>
> > >
>
> > > > Hey Guys i Need Help , When i run
Charlie Winn wrote:
> excuse me but don't be so *** rude , i did run this program and it did
> run correctly and if you want me to prove it with screenshots so be it , so
> don't make accusations ** Gary ** i only came here for some help not to be
> accused of not even running my program
H
On Feb 3, 2014 1:05 PM, "Charlie Winn" wrote:
>
> On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
> > On 02/02/2014 01:16 PM, Charlie Winn wrote:
> >
> > > Hey Guys i Need Help , When i run this program i get the 'None' Under
the program, see what i mean by just running it , can som
On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
> On 02/02/2014 01:16 PM, Charlie Winn wrote:
>
> > Hey Guys i Need Help , When i run this program i get the 'None' Under the
> > program, see what i mean by just running it , can someone help me fix this
>
> >
>
> > def Addition():
On Sun, 02 Feb 2014 13:46:24 -0800, Gary Herron wrote:
> Sorry, but in fact you did *not* run this program as you claim.
+1
I can also see a call to a function named Question, but I can't see where
that function is defined.
That might not be a major issue, because I don't think the while
con
On 02/02/2014 01:16 PM, Charlie Winn wrote:
Hey Guys i Need Help , When i run this program i get the 'None' Under the
program, see what i mean by just running it , can someone help me fix this
def Addition():
print('Addition: What are two your numbers?')
1 = float(input('First Number:
On Sun, 02 Feb 2014 13:16:44 -0800, Charlie Winn wrote:
> Hey Guys i Need Help , When i run this program i get the 'None' Under
> the program, see what i mean by just running it , can someone help me
> fix this
>
> def Addition():
> print('Addition: What are two your numbers?')
> 1 = floa
Hey Guys i Need Help , When i run this program i get the 'None' Under the
program, see what i mean by just running it , can someone help me fix this
def Addition():
print('Addition: What are two your numbers?')
1 = float(input('First Number:'))
2 = float(input('Second Number:'))
p
On Fri, Oct 4, 2013 at 9:15 AM, Dennis Lee Bieber wrote:
> On Thu, 3 Oct 2013 10:25:47 +1000, Chris Angelico
> declaimed the following:
>
>>On Thu, Oct 3, 2013 at 9:47 AM, Dennis Lee Bieber
>>wrote:
>>> try:
>>> numItems = int(raw_input("\n\nHow many values? "))
>>> except:
On Thu, Oct 3, 2013 at 9:47 AM, Dennis Lee Bieber wrote:
> try:
> numItems = int(raw_input("\n\nHow many values? "))
> except: #naked exception is not really good programming
> print "Invalid input, exiting..."
> sys.exit(1)
Please don't _ever_ advocate this pr
On Wednesday, October 2, 2013 4:31:03 PM UTC+5:30, Chris Angelico wrote:
> On Wed, Oct 2, 2013 at 8:44 PM, JonDoe297 wrote:
>
> > Is there any way to make it smaller? It does it's job, but I want it to
> > look smaller, more efficient.
>
>
>
> Yes, it is, but let me first clarify something: "S
On Wed, Oct 2, 2013 at 8:44 PM, JonDoe297 wrote:
> Is there any way to make it smaller? It does it's job, but I want it to look
> smaller, more efficient.
Yes, it is, but let me first clarify something: "Smaller" and "more
efficient" are two quite different concepts. Efficiency doesn't matter
to
You may remember me from this :
https://groups.google.com/forum/#!topic/comp.lang.python/PIkUno3avkw
I need help to increase the efficiency of this code :
global repeat
repeat=1
def main():
c=int(raw_input("How many numbers do you want to work? (Min. 2 Max. 3) "))
if c==2:
x
ATTENTION: Limited Time OFFER For F.REE!!
* You will be shocked With This Amazign OFFER!!
* Weight Loss Calculator .. Down.load F.ree
>> http://www.book-mall.com/offers/weightloss-calculator/
- The weight loss calculator allows you to estimate your weekly and
monthly weight loss. Just
I am pleased to announce the third public release of stats for Python.
This is a minor point release, mostly consisting of improved tests and
documentation, plus the addition of six new statistics functions:
midhinge, quartile_skewness, cumulative_sum, running_sum, stderrskewness,
stderrkurtosi
I am pleased to announce the second public release of stats for Python,
and the first targeted at Python 3.x.
http://pypi.python.org/pypi/stats
stats is a pure-Python module providing basic statistics functions
similar to those found on scientific calculators. It has over 40
statistics functio
>2010/10/17 Steven D'Aprano :
>> http://pypi.python.org/pypi/stats
In article
Vlastimil Brom wrote:
>Thanks for this useful module!
>I just wanted to report a marginal error triggered in the doctests:
>
>Failed example:
>isnan(float('nan'))
>Exception raised:
>Traceback (most recent cal
Steven D'Aprano wrote:
On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote:
Steven D'Aprano writes:
On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
I already have a stats module:
/usr/lib/python2.5/site-packages/stats.py
The name of my module is n
On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote:
> Steven D'Aprano writes:
>
>> On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
>>
>> > I already have a stats module:
>> > /usr/lib/python2.5/site-packages/stats.py
>>
>> The name of my module is not set in stone.
>>
>> I can
Steven D'Aprano writes:
> On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
>
> > I already have a stats module:
> > /usr/lib/python2.5/site-packages/stats.py
>
> The name of my module is not set in stone.
>
> I can't help what site-packages you have, but the above is not on
> PyPI
On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote:
> I already have a stats module:
> /usr/lib/python2.5/site-packages/stats.py
The name of my module is not set in stone.
I can't help what site-packages you have, but the above is not on PyPI,
and it's certainly not part of the sta
2010/10/17 Steven D'Aprano :
> I am pleased to announce the first public release of stats for Python.
>
> http://pypi.python.org/pypi/stats
>
> stats is a pure-Python module providing basic statistics functions
> similar to those found on scientific calculators. It currently includes:
>
> Univariat
On Sun, 2010-10-17 at 17:10 +, Steven D'Aprano wrote:
> I am pleased to announce the first public release of stats for Python.
>
> http://pypi.python.org/pypi/stats
Quick comment on your sum() function:
http://docs.python.org/library/math.html#math.fsum
(in 2.6 and above)
should do the sa
Steven D'Aprano wrote:
I am pleased to announce the first public release of stats for Python.
http://pypi.python.org/pypi/stats
stats is a pure-Python module providing basic statistics functions
similar to those found on scientific calculators. It currently includes:
Univariate statistics in
I am pleased to announce the first public release of stats for Python.
http://pypi.python.org/pypi/stats
stats is a pure-Python module providing basic statistics functions
similar to those found on scientific calculators. It currently includes:
Univariate statistics including:
* arithmetic, har
On Thu, Jun 24, 2010 at 10:33 AM, ilovesss2004 wrote:
> I use python 2.5
> Must change version? Is there any other solution?
It works for me:
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more informatio
ilovesss2004 wrote:
> If I run
> 1.0/10**10
> python will return 0
>
> How can I make python return 1e-10?
If you meant 1/10**10, by default this returns an integer in Python 2.x.
With "from __future__ import division" you can opt for the division of
integers to return a float:
>>> 1/10**10
0
Le 24/06/2010 18:33, ilovesss2004 a écrit :
> I use python 2.5
> Must change version? Is there any other solution?
With python 2.6.5, I obtain 1e-10.
--
Etienne
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2010-06-24 at 09:33 -0700, ilovesss2004 wrote:
> On Jun 24, 5:50 pm, Tim Harig wrote:
> > On 2010-06-24, ilovesss2004 wrote:
> >
> > > If I run
> > > 1.0/10**10
> > > python will return 0
> >
> > Python 2.6.4 (r264:75706, Dec 11 2009, 23:02:59)
> > [GCC 3.4.6] on linux2
> > Type "help", "
On Jun 24, 5:50 pm, Tim Harig wrote:
> On 2010-06-24, ilovesss2004 wrote:
>
> > If I run
> > 1.0/10**10
> > python will return 0
>
> Python 2.6.4 (r264:75706, Dec 11 2009, 23:02:59)
> [GCC 3.4.6] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> 1.0/10**10
On Thu, 24 Jun 2010 08:42:32 -0700 (PDT)
ilovesss2004 wrote:
> If I run
> 1.0/10**10
> python will return 0
>
> How can I make python return 1e-10?
What version of Python are you using?
Python 2.6.4 (r264:75706, Jan 28 2010, 11:26:00)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd7
Type "help", "c
On 2010-06-24, ilovesss2004 wrote:
> If I run
> 1.0/10**10
> python will return 0
Python 2.6.4 (r264:75706, Dec 11 2009, 23:02:59)
[GCC 3.4.6] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1.0/10**10
1e-10
>>>
What version are you using?
> How can I make
On 06/24/2010 05:42 PM, ilovesss2004 wrote:
> If I run
> 1.0/10**10
> python will return 0
>
> How can I make python return 1e-10?
It returns 1e-10.
--
http://mail.python.org/mailman/listinfo/python-list
I believe this is fixed in python3
On Thu, Jun 24, 2010 at 4:42 PM, ilovesss2004 wrote:
> If I run
> 1.0/10**10
> python will return 0
>
> How can I make python return 1e-10?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Dave
-
Email: r...@crankyadmin.net
Web: w
If I run
1.0/10**10
python will return 0
How can I make python return 1e-10?
--
http://mail.python.org/mailman/listinfo/python-list
Someone Something wrote:
> > from Tkinter import *;
Try to avoid this. Better import Tkinter. And don't forget to import
Tkconstants too!
> > rate=Frame(root)
> > income=Frame(root)
> > result=Frame(root)
Why do you use three frames? You only need one. And you can make your
class TaxCalc inherit
Someone Something wrote:
I'm writing a simple tax calculator with Tkinter (just for fun).
Here's my current code:
[snip]
def printResult(self):
if self.nrate is None | self.nincome is None:
There's no such attribute as nrate or nincome.
Also, &qu
I'm writing a simple tax calculator with Tkinter (just for fun).
Here's my current code:
from Tkinter import *;
class TaxCalc:
def __init__(self, root):
rate=Frame(root)
rate.pack()
income=
1 - 100 of 129 matches
Mail list logo