On 02/01/16 17:56, Robin Koch wrote:
> Am 02.01.2016 um 17:09 schrieb Tony van der Hoff:
>> On 02/01/16 16:57, Robin Koch wrote:
>>> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
>>
>> But did you actually test it?
>
> Yes, should work for n >= 1.
>
> Why do you ask?
>
>From your orig
let's put an end to this.
from math import log
# simple one to understand. complexity: O(n*log(n))
def countzeros_va(n):
count = 0
for x in xrange(1, n + 1):
while x % 5 == 0:
count += 1
x //= 5
return count
# better approach. complexity: O(log(n))
def
Robin Koch writes:
> Am 02.01.2016 um 22:57 schrieb Chris Angelico:
> >>> But did you actually test it?
> >>
> >> Yes, should work for n >= 1.
By “test it”, Chris of course means test it *by implementing it in a
program and running that program in Python*.
> >> Why do you ask?
> >
> > Your "sho
Am 02.01.2016 um 22:57 schrieb Chris Angelico:
On Sun, Jan 3, 2016 at 3:56 AM, Robin Koch wrote:
Am 02.01.2016 um 17:09 schrieb Tony van der Hoff:
On 02/01/16 16:57, Robin Koch wrote:
sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
But did you actually test it?
Yes, should wo
Mark Lawrence wrote:
> Please don't top post, it's extremely annoying when trying to follow
> long threads.
As are full quotes.
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Jan 3, 2016 at 3:56 AM, Robin Koch wrote:
> Am 02.01.2016 um 17:09 schrieb Tony van der Hoff:
>>
>> On 02/01/16 16:57, Robin Koch wrote:
>>>
>>> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
>>
>>
>> But did you actually test it?
>
>
> Yes, should work for n >= 1.
>
> Why do you
On 02/01/2016 20:09, yehudak . wrote:
Hi again,
I looked a little deeper at your code. Smart solution and kudos.
Yehuda
Still top posting? Thanks a bunch.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mai
On 02/01/2016 20:02, yehudak . wrote:
Hello vbr,
That's EXACTLY what I needed. rstrip is new for me so I'm going to Dr.
Google to learn.
On my efforts I was struggling with .pop() but wasn't very successful...
Thank you so much,
Yehuda
How many times do you have to be asked to not top post?
Hi again,
I looked a little deeper at your code. Smart solution and kudos.
Yehuda
On Sat, Jan 2, 2016 at 10:02 PM, yehudak . wrote:
> Hello vbr,
> That's EXACTLY what I needed. rstrip is new for me so I'm going to Dr.
> Google to learn.
>
> On my efforts I was struggling with .pop() but wasn't
Hello vbr,
That's EXACTLY what I needed. rstrip is new for me so I'm going to Dr.
Google to learn.
On my efforts I was struggling with .pop() but wasn't very successful...
Thank you so much,
Yehuda
On Sat, Jan 2, 2016 at 8:29 PM, Vlastimil Brom
wrote:
> 2016-01-02 18:34 GMT+01:00 yehudak . :
>
2016-01-02 18:34 GMT+01:00 yehudak . :
[partly edited for bottom posting]
> On Sat, Jan 2, 2016 at 5:24 PM, Vlastimil Brom
> wrote:
>>
>> 2016-01-02 14:14 GMT+01:00 yehudak . :
>> >
[...]>> > On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom
>> >
>> > wrote:
>> >>
>> >> 2016-01-02 12:49 GMT+01:00 :
On 02.01.16 18:33, Tim Chase wrote:
or mathematically:
sum(1 for _ in itertools.takewhile(
lambda x: n % (10**x) == 0,
itertools.count(1)))
The mathematician would prove that the result is not larger than 100/4.
--
https://mail.python.org/mailman/listinfo/python-list
On 02/01/2016 17:34, yehudak . wrote:
vbr,
I tried using .pop() but could not get what I wanted .Also, I can't see an
advantage in reversing the number.
Would you care to write explicitly the program for me (and probably for
other too)?
Brute Force is the style I'm thinking about.
Sorry, but I l
vbr,
I tried using .pop() but could not get what I wanted .Also, I can't see an
advantage in reversing the number.
Would you care to write explicitly the program for me (and probably for
other too)?
Brute Force is the style I'm thinking about.
Sorry, but I learn most from viewing the code.
Apprec
On Sat, Jan 2, 2016 at 2:56 PM, Robin Koch wrote:
>
> Yes, should work for n >= 1.
>
The first power of 10 for which it fails in my machine is 10 ^ 17,
which is not that much for modern computers. Discrete math should not
meet floating points.
I would post the "canonical" solution here if Peter
Robin Koch wrote:
> Am 02.01.2016 um 12:49 schrieb katye2...@gmail.com:
>
>> I'm trying to write a python program to find how many trailing zeros
>> are in 100! (factorial of 100). I used factorial from the math
>> module, but my efforts to continue failed. Please help.
>
> Using not Python, but
Am 02.01.2016 um 17:09 schrieb Tony van der Hoff:
On 02/01/16 16:57, Robin Koch wrote:
sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
But did you actually test it?
Yes, should work for n >= 1.
Why do you ask?
--
Robin Koch
--
https://mail.python.org/mailman/listinfo/python-list
On 02/01/16 16:57, Robin Koch wrote:
> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
But did you actually test it?
--
Tony van der Hoff | mailto:t...@vanderhoff.org
Ariège, France |
--
https://mail.python.org/mailman/listinfo/python-list
On 2016-01-02 03:49, katye2...@gmail.com wrote:
> I'm trying to write a python program to find how many trailing
> zeros are in 100! (factorial of 100). I used factorial from the
> math module, but my efforts to continue failed. Please help.
Pretty easy to do with strings:
from math import fact
Am 02.01.2016 um 14:14 schrieb yehudak .:
Thank you so much, but...
All that is Chinese for me.
Can you show a 'normal' Python code for me?
How about:
>>> from math import log
>>> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)])
}:-)
(That implements my procedure in my other answe
Am 02.01.2016 um 12:49 schrieb katye2...@gmail.com:
I'm trying to write a python program to find how many trailing zeros
are in 100! (factorial of 100). I used factorial from the math
module, but my efforts to continue failed. Please help.
Using not Python, but math:
Every "0" at the end of 1
On 02/01/2016 13:14, yehudak . wrote:
Vlastimil,
Thank you so much, but...
All that is Chinese for me.
Can you show a 'normal' Python code for me?
Yehuda
On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom
wrote:
2016-01-02 12:49 GMT+01:00 :
Hi, newbie here!
I'm trying to write a python program
2016-01-02 14:14 GMT+01:00 yehudak . :
> Vlastimil,
> Thank you so much, but...
> All that is Chinese for me.
> Can you show a 'normal' Python code for me?
>
> Yehuda
>
> On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom
> wrote:
>>
>> 2016-01-02 12:49 GMT+01:00 :
>> > Hi, newbie here!
>> > I'm tryi
On Sat, Jan 2, 2016 at 8:14 AM, yehudak . wrote:
> Vlastimil,
> Thank you so much, but...
> All that is Chinese for me.
> Can you show a 'normal' Python code for me?
>
> Yehuda
>
> On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom
> wrote:
>
> > 2016-01-02 12:49 GMT+01:00 :
> > > Hi, newbie here!
Vlastimil,
Thank you so much, but...
All that is Chinese for me.
Can you show a 'normal' Python code for me?
Yehuda
On Sat, Jan 2, 2016 at 2:44 PM, Vlastimil Brom
wrote:
> 2016-01-02 12:49 GMT+01:00 :
> > Hi, newbie here!
> > I'm trying to write a python program to find how many trailing zeros
2016-01-02 12:49 GMT+01:00 :
> Hi, newbie here!
> I'm trying to write a python program to find how many trailing zeros are in
> 100! (factorial of 100).
> I used factorial from the math module, but my efforts to continue failed.
> Please help.
>
> Thank you,
> Yehuda
> --
> https://mail.python.o
On Saturday, January 2, 2016 at 1:49:47 PM UTC+2, katy...@gmail.com wrote:
> Hi, newbie here!
> I'm trying to write a python program to find how many trailing zeros are in
> 100! (factorial of 100).
> I used factorial from the math module, but my efforts to continue failed.
> Please help.
>
> Th
On 2 January 2016 at 22:49, wrote:
> Hi, newbie here!
Hi Yehuda
> I'm trying to write a python program to find how many trailing zeros are in
> 100! (factorial of 100).
> I used factorial from the math module, but my efforts to continue failed.
> Please help.
There is a special mailing list
28 matches
Mail list logo