On 23/01/2012 06:15, Shreesh bhat wrote:
Calculating the table is fast.
I think either my luckiness test (where i find the sum of all digits and
sum of squares of all digits of a large number)
or generating numbers is slow.
Don't think, know :) Tools like the profile or timeit modules are ther
Thank you all for helping me understand the overflow error.
I m a newbie on mailing lists.I apologize for my errors.
Program:
def sieve(maxi):
primes = range(2,maxi+1)
for i in primes:
j = 2
while i * j <= primes[-1]:
if i * j in primes:
primes.remove(i*j)
j += 1
Calculating the table is fast.
I think either my luckiness test (where i find the sum of all digits and
sum of squares of all digits of a large number)
or generating numbers is slow.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscri
On 01/22/2012 09:08 PM, Surya K wrote:
Well,
I have been doing a puzzle where I have to deal with number 10^18. A variable
can store that value but can't do operations.Ex: If I use range() on it, it
shows overflow error.
So, How do I handle this. I have to use range() for that number.. in this
Well,
I have been doing a puzzle where I have to deal with number 10^18. A variable
can store that value but can't do operations.Ex: If I use range() on it, it
shows overflow error.
So, How do I handle this. I have to use range() for that number.. in this
instance.
Also mention how to handle i
You sent me this message privately, instead of on the list (use
Reply-All in most mail programs). Two problems with that: 1) nobody
else gets to help 2) I don't give private help, except as a contractor.
On 01/22/2012 12:44 PM, Shreesh bhat wrote:
*Lucky numbers:*
def sieve(maxi):
prime
On 1/22/2012 5:43 PM, Alan Gauld wrote:
On 22/01/12 22:10, Jaidev Deshpande wrote:
In[1]: from mymodule import myfunc
In[3]: from mymodule import myfunc
it doesn't work as per the new changes. I have to close IPython and
start all over again.
You can use reload() to reload the entire module
On 1/22/2012 5:10 PM, Jaidev Deshpande wrote:
Dear List,
Suppose I have a function myfunc() in a module called mymodule.py
As usual, I import this function in IPython with
In[1]: from mymodule import myfunc
Now if I find that there is something wrong with myfunc, I can open
mymodule.py with a
On 22/01/12 22:10, Jaidev Deshpande wrote:
In[1]: from mymodule import myfunc
In[3]: from mymodule import myfunc
it doesn't work as per the new changes. I have to close IPython and
start all over again.
You can use reload() to reload the entire module, but I confess I don't
know how to relo
On Mon, Jan 23, 2012 at 03:40:26AM +0530, Jaidev Deshpande wrote:
> Dear List,
>
> Suppose I have a function myfunc() in a module called mymodule.py
[...]
> Now when I delete the original function and import the changed one,
>
> In[2]: del myfunc
> In[3]: from mymodule import myfunc
>
> it doesn
Dear List,
Suppose I have a function myfunc() in a module called mymodule.py
As usual, I import this function in IPython with
In[1]: from mymodule import myfunc
Now if I find that there is something wrong with myfunc, I can open
mymodule.py with a suitable editor and make the required changes.
On 22/01/12 11:37, Shreesh bhat wrote:
Steven wrote:
" Scale your numbers from time to time, to avoid them getting too big "
What does this mean?
It could be done in various ways but one simple example is,
low = 100
hi = 110
for n in range(low,hi):
... code uses n ...
c
On 01/22/2012 06:37 AM, Shreesh bhat wrote:
I m using Python 2.7
Steven wrote:
" Scale your numbers from time to time, to avoid them getting too big"
What does this mean?
inp refers to the sample input test case I have given at first.Its a string
containing two numbers,
The program has to handle
Shreesh bhat wrote:
> I m using Python 2.7
> Steven wrote:
> " Scale your numbers from time to time, to avoid them getting too big "
> What does this mean?
>
> inp refers to the sample input test case I have given at first.Its a
> string containing two numbers,
> The program has to handle large n
Well DNS would be easy, just modify /etc/resolve.conf ... the other files
you need to modify would depend on your distro because they all do
something slightly different it seems.
On Jan 22, 2012 3:25 AM, "Ganesh Kumar" wrote:
> I'm working on a simple web interface for an embedded computer. The
I m using Python 2.7
Steven wrote:
" Scale your numbers from time to time, to avoid them getting too big "
What does this mean?
inp refers to the sample input test case I have given at first.Its a string
containing two numbers,
The program has to handle large numbers till 10**18 and also has to ex
Shreesh bhat wrote:
*Lucky Numbers*
A number is called lucky if the sum of its digits, as well as the sum of
the squares of its digits is a prime number. How many numbers between A and
B are lucky?
Very little of this is relevant to your problem. In the future, please provide
a short, self-con
On 22/01/12 06:11, Shreesh bhat wrote:
Here goes some general comments that will make it esier to understand
your code and therefore, hopefully, the problem.
def isprime(n):
def islucky(n):
.
There are more efficient ways of doing both tests
but I'll igniore that for
I'm working on a simple web interface for an embedded computer. The
computer will ship with a static default ip that will then need to be
updated by the install tech who may not be tech/linux savvy.
Basicly I need to change the following system settings from a Django app.
1. IP Addres
2. Su
Shreesh bhat wrote:
> *Lucky Numbers*
> A number is called lucky if the sum of its digits, as well as the sum of
> the squares of its digits is a prime number. How many numbers between A
> and B are lucky?
> Input:
> The first line contains the number of test cases T. Each of the next T
> lines co
20 matches
Mail list logo