« first day (2955 days earlier)      last day (1978 days later) » 

6:17 AM
cbg
@raj Check out the documentation. This may either solve your problem chriswarrick.com/blog/2014/09/15/… or give you the search terms you need to find the solution
 
 
5 hours later…
11:46 AM
>>> result = sum(2 for i in range(1, 5+1) if 25 % i == 0)
there's an expression like this. Is this adding range digits to 2?
 
it's the sum of a generator expression with a filtering conditional
it's equivalent to
result = 0
for i in range(1, 5+1):
    if 25 % i == 0:
        result += 2
the generator expression itself contains only twos a given number of times, and then these values are added up
you could just do result = 2*num_items if you figured out the number of items given by the generator
this will give you a list that contains the same twos: [2 for i in range(1, 5+1) if 25 % i == 0]
(but with a generator expression the list is never created, the values are summed on the fly)
 
thanks
 
no problem
 
Cabbage
 
cbg
 
11:56 AM
@AbhimanyuAryan I'm curious where that code came from. It's not a very efficient way of counting factors, but I guess it's ok if the range is small.
 
Ah, ok. I'm glad it has if end**2 == n: result -= 1; I was wondering how it handled perfect squares. :)
A better algorithm for large n is to find the prime factorization of n and calculate the number of divisors from that. I'll illustrate the method for a number with 3 different prime factors. If n = p**a * q**b * r**c, where (p,q,r) are prime, then there are (a+1)*(b+1)*(c+1) numbers that divide n.
 
thanks
 
 
2 hours later…
2:10 PM
wish y'all a pleasant Sunday evening :)
 
 
4 hours later…
5:40 PM
cbg-evening guys
 
6:14 PM
rb folks
 
Hey guys! Is there anyone in here who's done a little python programming for data science? :)
 
What's "a little python"? Is that different from a "big python"?
 
More like being all from somewhat knowing in data science Python programming to expert level :)
Not that my following question is that hard though, just more curiosity
 
8:11 PM
Just dropped in out of the sky after reading sopython.com/wiki/2018_Q3_General_Meeting.
to comment that some time ago the room appeared to have become less relaxed and less tolerant, so I stopped coming by. Any RO wishing to engage about this can contact me as steve@holdenweb.com, but it's not really a big deal.
 
That's fairly optimistic of you, considering that we're still waiting on this fancy new communication channel we've been promised
 
 
2 hours later…
10:30 PM
Hope springs eternal.
 

« first day (2955 days earlier)      last day (1978 days later) »