Re: [Tutor] Need help speeding up algorithm.

2007-09-24 Thread Ian Witham
On 9/25/07, Terry Carroll <[EMAIL PROTECTED]> wrote: > > On Tue, 25 Sep 2007, Ian Witham wrote: > > > I am attempting to do this project > for > > the Sphere Online Judge. > > (Summary of the problem: for a given integer N, determine the number of > trailing ze

Re: [Tutor] Need help speeding up algorithm.

2007-09-24 Thread Terry Carroll
On Tue, 25 Sep 2007, Ian Witham wrote: > I am attempting to do this project for > the Sphere Online Judge. (Summary of the problem: for a given integer N, determine the number of trailing zeroes in N! For example, for N=10, N! = 3628800, so the number of t

Re: [Tutor] python problem

2007-09-24 Thread Michael Langford
Look here. Do this: http://en.wikipedia.org/wiki/Binary_search -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com On 9/25/07, Chris <[EMAIL PROTECTED]> wrote: > > > > ***I have this GUESSING GA

[Tutor] python problem

2007-09-24 Thread Chris
I have this GUESSING GAME code found below: - import random number = random.randint(1, 101) print "I've thought of a number between 1 and 100." print "Try and guess it!" print guess = input( "What's your guess? ") while guess != number: if guess > number: print

Re: [Tutor] largest and smallest numbers

2007-09-24 Thread Kent Johnson
Christopher Spears wrote: > How can I find the largest float and complex numbers? I don't know how to do this in standard Python. Here are some answers that use Numeric and numpy: http://groups.google.com/group/comp.lang.python/msg/fa7a761411ced62b http://www.thescripts.com/forum/post2028282-8.h

Re: [Tutor] largest and smallest numbers

2007-09-24 Thread Terry Carroll
On Mon, 24 Sep 2007, Christopher Spears wrote: > How can I find the largest float and complex numbers? That's an interesting question.. I just tried this: x = 2.0 while True: x = x*2 print x if repr(x) == "1.#INF": break to just keep doubling X until Python began representing it as

[Tutor] Need help speeding up algorithm.

2007-09-24 Thread Ian Witham
Hello, I am attempting to do this project for the Sphere Online Judge. I think my program is getting the right answer, however it exceeds the 6s time limit on the judge machine. Here is my code: import sys testnums = [] tests = int(sys.stdin.r

Re: [Tutor] quick question

2007-09-24 Thread Terry Carroll
On Mon, 24 Sep 2007, max baseman wrote: > for example how hard would it be to write a program that take's a > input of a in out table and finds the rule > > ex: > > in out > 10 23 > 5 13 > 1 5 > 0 3 > > the rule is in*2+3 This is call

[Tutor] largest and smallest numbers

2007-09-24 Thread Christopher Spears
One of the exercises from Core Python Programmng (2nd Edition) asks me to determine the largest and smallest integers, float, and complex numbers my system can handle. Using python.org and Google, I have discovered my system's largest and smallest ingtegers: >>> import sys >>> sys.maxint 21474836

[Tutor] quick question

2007-09-24 Thread max baseman
hello just a quickie today :) how is python with patters or finding a rule for something ie: in out tables for example how hard would it be to write a program that take's a input of a in out table and finds the rule ex: in out 10 23 5 13 1

Re: [Tutor] pythons xf86misc documentation ?

2007-09-24 Thread Noufal Ibrahim
dave selby wrote: > Can anyone tell me where the documentation for pythons xf86misc module > is, ie what methods are avalible ? I've not used this module you mention myself but if it's got docstrings and inline documentation, you can get help by importing the module and then doing a help(xf86mi

Re: [Tutor] Capturing ctrl-c

2007-09-24 Thread Jason Massey
Interesting. As Michael suggested this works, mostly: from time import sleep def loop(): x = 0 while 1: print "x:",x x += 1 sleep(0.5) if __name__ == "__main__": while 1: try: loop() except KeyboardInterrupt: print "Nop

Re: [Tutor] python problem - help!!

2007-09-24 Thread Kent Johnson
Chris wrote: > I need your help! > > > > I have this problem that I can’t seem to figure out. Can you help? The > problem is listed below, and below it is my code that I have so far. This looks like a homework problem. We can help you understand Python but we won't give you the answer. >

Re: [Tutor] tutor_request

2007-09-24 Thread Luke Paireepinart
oops, forgot to send this to tutor as well. And I'm the one always complaining about direct e-mails :) Luke Paireepinart wrote: bedilu woldemariam wrote: help! here, take this: Hope that helped, -Luke --- Begin Message --- bedilu woldemariam wrote: help! here, take this: Hope

[Tutor] tutor_request

2007-09-24 Thread bedilu woldemariam
help! - Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search.___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [Fwd: Re: python problem - help!!]

2007-09-24 Thread bhaaluu
> print 'testvar: %.2f' % testvar > Output: > testvar: 10.0123 Should be: print 'testvar: %.4f' % testvar Output: testvar: 10.0123 -- bhaaluu at gmail dot com On 9/24/07, bhaaluu <[EMAIL PROTECTED]> wrote: > Greetings, > > I ran the code sample you sent and found a couple of errors > that woul

Re: [Tutor] [Fwd: Re: python problem - help!!]

2007-09-24 Thread bhaaluu
Greetings, I ran the code sample you sent and found a couple of errors that wouldn't let the code run. The first error has to do with variable assignment. When you assign a variable, it is usually on the left and what you want to assign to it is on the right. See Lines 25,29. The second error ha