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