Re: Calculator

2020-02-01 Thread Marek Mosiewicz
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

Re: Sandboxing eval() (was: Calculator)

2020-01-27 Thread Musbur
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

Re: Sandboxing eval() (was: Calculator)

2020-01-20 Thread Chris Angelico
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

Re: Sandboxing eval() (was: Calculator)

2020-01-20 Thread musbur
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

Re: Sandboxing eval() (was: Calculator)

2020-01-20 Thread Stephan Lukits
> 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

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Grant Edwards
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

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Chris Angelico
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

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Jon Ribbens via Python-list
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

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Paul Moore
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

Sandboxing eval() (was: Calculator)

2020-01-19 Thread musbur
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

Re: Calculator

2020-01-16 Thread Chris Angelico
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 >

Re: Calculator

2020-01-16 Thread Python
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

Re: Calculator

2020-01-16 Thread samnalty
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

Re: Calculator

2020-01-15 Thread Python
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

Re: Calculator

2020-01-15 Thread andershe02
Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: Calculator

2020-01-15 Thread samnalty
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

Calculator

2020-01-15 Thread andershe02
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

Re: JavaScript Calculator Program

2019-12-07 Thread Chris Angelico
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

JavaScript Calculator Program

2019-12-07 Thread ferzan saglam
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

Re: CodeAcademy Python Tip Calculator

2017-09-10 Thread Emil Natan
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 *

Re: CodeAcademy Python Tip Calculator

2017-09-10 Thread Bill
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

CodeAcademy Python Tip Calculator

2017-09-10 Thread Cai Gengyang
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

Re: I need help with making my calculator

2017-05-20 Thread Steve D'Aprano
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

Re: I need help with making my calculator

2017-05-19 Thread MRAB
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

I need help with making my calculator

2017-05-19 Thread garsink
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,

Re: calculator between raster

2016-10-09 Thread chrischris201444
Τη Κυριακή, 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

Re: calculator between raster

2016-10-09 Thread Christian Gollwitzer
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

calculator between raster

2016-10-09 Thread chrischris201444
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

Re: Creating a calculator

2016-07-05 Thread BartC
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

Re: Creating a calculator

2016-07-04 Thread Antoon Pardon
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

Re: Creating a calculator

2016-07-04 Thread Pierre-Alain Dorange
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

Re: Creating a calculator

2016-07-01 Thread Jussi Piitulainen
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

Re: Creating a calculator

2016-07-01 Thread Christopher Reimer
> 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

Re: Creating a calculator

2016-07-01 Thread alister
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

Re: Creating a calculator

2016-07-01 Thread 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 needed to work around the crash. A later line of code > wil

Re: Creating a calculator

2016-07-01 Thread Jussi Piitulainen
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

Re: Creating a calculator

2016-07-01 Thread Christopher Reimer
> 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

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
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

Re: Creating a calculator

2016-07-01 Thread Jussi Piitulainen
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

Re: Creating a calculator

2016-07-01 Thread Christopher Reimer
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

Re: Creating a calculator

2016-07-01 Thread Chris Warrick
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. >> >> -

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
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

Re: Creating a calculator

2016-07-01 Thread Chris Warrick
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"

Re: Creating a calculator

2016-06-30 Thread Jussi Piitulainen
#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

Re: Creating a calculator

2016-06-30 Thread Michael Torrie
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.

Creating a calculator

2016-06-30 Thread Elizabeth Weiss
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

Re: Python Calculator

2016-02-01 Thread Steven D'Aprano
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

Re: Python Calculator

2016-02-01 Thread Zachary Ware
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

Python Calculator

2016-02-01 Thread Ryan Young
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

Re: Calculator Problem

2014-02-05 Thread 88888 Dihedral
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?

Re: Calculator Problem

2014-02-05 Thread Peter Otten
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) >>

Re: Calculator Problem

2014-02-05 Thread Joshua Landau
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

Re: Calculator Problem

2014-02-04 Thread Dan Sommers
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

Re: Calculator Problem

2014-02-04 Thread Chris Angelico
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

Re: Calculator Problem

2014-02-04 Thread Roy Smith
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

Re: Calculator Problem

2014-02-04 Thread Mario R. Osorio
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?

Re: Calculator Problem

2014-02-04 Thread David Hutto
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

Re: Calculator Problem

2014-02-04 Thread David Hutto
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?

Re: Calculator Problem

2014-02-03 Thread Denis McMahon
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 =

Re: Calculator Problem

2014-02-03 Thread Ian Kelly
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

Re: Calculator Problem

2014-02-03 Thread Gary Herron
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.

Re: Calculator Problem

2014-02-03 Thread Steven D'Aprano
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

Re: Calculator Problem

2014-02-03 Thread Charlie Winn
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

Re: Calculator Problem

2014-02-03 Thread Roy Smith
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

Re: Calculator Problem

2014-02-03 Thread Joel Goldstick
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

Re: Calculator Problem

2014-02-03 Thread Charlie Winn
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():

Re: Calculator Problem

2014-02-02 Thread Denis McMahon
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

Re: Calculator Problem

2014-02-02 Thread Gary Herron
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:

Re: Calculator Problem

2014-02-02 Thread Alister
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

Calculator Problem

2014-02-02 Thread Charlie Winn
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

Re: Efficency help for a Calculator Program

2013-10-03 Thread Chris Angelico
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:

Re: Efficency help for a Calculator Program

2013-10-02 Thread Chris Angelico
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

Re: Efficency help for a Calculator Program

2013-10-02 Thread JonDoe297
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

Re: Efficency help for a Calculator Program

2013-10-02 Thread Chris Angelico
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

Efficency help for a Calculator Program

2013-10-02 Thread JonDoe297
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

Weight Loss Calculator .. Down.load F.ree

2012-06-24 Thread Mohamed Gad
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

ANN: stats0.1.2a calculator statistics for Python

2010-12-31 Thread Steven D'Aprano
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

ANN: stats0.1.1a calculator statistics for Python

2010-11-13 Thread Steven D'Aprano
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-19 Thread Chris Torek
>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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-19 Thread Jean-Michel Pichavant
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Steven D'Aprano
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Ben Finney
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Steven D'Aprano
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Vlastimil Brom
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Tim Wintle
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

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Jean-Michel Pichavant
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

ANN: stats 0.1a calculator statistics for Python

2010-10-17 Thread 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: Univariate statistics including: * arithmetic, har

Re: use python as a calculator

2010-06-24 Thread Ian Kelly
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

Re: use python as a calculator

2010-06-24 Thread Peter Otten
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

Re: use python as a calculator

2010-06-24 Thread Etienne Rousee
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

Re: use python as a calculator

2010-06-24 Thread Tim Wintle
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", "

Re: use python as a calculator

2010-06-24 Thread ilovesss2004
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

Re: use python as a calculator

2010-06-24 Thread D'Arcy J.M. Cain
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

Re: use python as a calculator

2010-06-24 Thread Tim Harig
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

Re: use python as a calculator

2010-06-24 Thread Thomas Jollans
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

Re: use python as a calculator

2010-06-24 Thread David Houston
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

use python as a calculator

2010-06-24 Thread ilovesss2004
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

Re: Tax Calculator--Tkinter

2009-11-09 Thread Marcus Gnaß
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

Re: Tax Calculator--Tkinter

2009-11-08 Thread MRAB
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

Tax Calculator--Tkinter

2009-11-08 Thread Someone Something
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   2   >