[Tutor] Can my code be optimized any further (speed-wise)?
Alan Gauld
alan.gauld at btinternet.com
Sun Oct 8 10:13:18 CEST 2006
Thanks, thats a lot clearer.
> a = the number of times i'm going to read input to evaluate
> lst = the factors of 5. I.e. (5, 5^2, 5^3, 5^4.... etc) until the
> last one
> wich is smaller then 1000000000
OK, I had assumed it was a list of sample factorial results.
Not reading it carefully enough. But a comment would have
been good since its not self evident.
> Example input of this program:
> 5 #number of times i'm going to read
> in a
So a could be called iterations maybe?
> number
> 3 # 3! = 6, no trailing 0's zo the
> output
and b could be called factorial_number or similar?
> would be 0
> 5 # 5! = 120, 1 trailing 0's so the
> output
> would be 1
> 50! #50!= <very big number>, 12
> trailing 0's
> (50/5 + 50/25=12)
> 100! #100!= <very big number>, 24
> trailing 0's
> (100/5 + 100/25 = 24)
> 125! #125!= <very big number>, 31
> trailing 0's
> (125/5 + 125/25 +125/125 = 31)
>
> Output would be:
> 0
> 1
> 12
> 24
> 31
>
> Hope this clarifies what i'm trying to achieve here...
Yes, thats very clear now.
I'll go back to the original post and reread the code.
Alan G.
More information about the Tutor
mailing list