We can pack multiple if-loops and if-else within a list generators.
Here is an example :
[i*j for i in range(1,10) for j in range(1,10) if i==j ]
[1, 4, 9, 16, 25, 36, 49, 64, 81]
Another one:
noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)]
primes = [x for x in range(2, 50) if
is a fresh breeze regarding the
current scenario :)
On Sun, Sep 13, 2009 at 7:51 AM, Senthil Kumaran orsent...@gmail.comwrote:
On Sun, Sep 13, 2009 at 02:12:47AM +0530, Shashwat Anand wrote:
Google CodeJam doesn't have a feature where we can sort solutions by
language
Go here http://www.go
out the rightmost 5 digits of what remains
Highly inaccurate but helped crossing icpc prelims in 1st year because
there were humans who checked my solution with smaller inputs :)
On Mon, Sep 14, 2009 at 6:36 PM, Shashwat Anand
anand.shash...@gmail.com wrote:
How do we calculate last 5
Please be a little more precise as to what do you exactly mean by 'validat'
? What exactly do you want to achieve with it. Sample Input and desired
output will help.
On Tue, Sep 15, 2009 at 1:00 PM, Anand Balachandran Pillai
abpil...@gmail.com wrote:
On Tue, Sep 15, 2009 at 11:38 AM, Sampath
One really simple way is to do :
$ time code.py
Works for me for simple codes. For accuracy there is timeit :)
On Fri, Sep 18, 2009 at 4:02 PM, Vishal vsapr...@gmail.com wrote:
On Fri, Sep 18, 2009 at 3:43 PM, steve st...@lonetwin.net wrote:
On 09/18/2009 03:33 PM, Vamsi wrote:
How to place
*# 1:*
sum([1, 2, 3], 4)
10
How does it actually work ?
( ( (1 + 2) + 3) + 4) or ( ( (4 + 1) + 2 + 3)
sum( ) - sum: (sequence[, start]), so shouldn't 4 be the 'start' that's
second case ?
Note that sum(range(n), m) is equivalent to reduce(operator.add, range(n),
m)
sum ( [ [ 1 ], [ 2, 3 ]
@Navin : Thanks
in case #2:
reduce(lcm2, mylist) works fine
On Fri, Oct 30, 2009 at 5:58 AM, Navin Kabra navin.ka...@gmail.com wrote:
Something like this should work:
def lcm2(a, b):
return a*b/fractions.gcd(a,b)
def lcm(mylist):
return reduce(lcm2, mylist)
Actually, this
I left it. Will try again someday, the quest for perfection or should I say
53 chars should last by then :)
On Sun, Nov 15, 2009 at 11:58 AM, Abhishek Mishra ideam...@gmail.comwrote:
I tried a lot, I give up. But I noticed this,
if 'foo'.count (sub, [start, end])
allowed us to place a regexp
@Kenneth Nice effort .. I had tried Microsoft Certification some 3 years
ago..it was a bunch of crap..I had not mentioned it even in my resume and
all the faith in certification programs was lost.
On Wed, Dec 16, 2009 at 1:54 PM, Kenneth Gonsalves law...@au-kbc.orgwrote:
On Wednesday 16 Dec
How can we retrieve images from PDFs. I need both images and the text
beneath the image to form a database. I was able to parse text via PDFMiner
but was crippled when it leads to images.
___
BangPypers mailing list
BangPypers@python.org
Seen as somebody tweet, nice read :)
On Sun, Jan 31, 2010 at 12:50 AM, nikunj badjatya
nikunjbadja...@gmail.comwrote:
Hi,
Interesting Read indeed..!
Thanks !!
--
Nikunj Badjatya
BTech
___
BangPypers mailing list
BangPypers@python.org
@Jeffrey,
bpython is a bit unstable and crash-prone but I prefer it over Ipython.
On Sat, Feb 6, 2010 at 7:45 PM, Jeffrey Jose jeffjosej...@gmail.com wrote:
[ caution, huge email follows ]
Hey Senthil,
I was under the impression that everyone here used and loved IPython. Boy,
was I wrong.
here is the bpython screencast : http://*bpython*-interpreter.org/static/*
bpython*-screencast01.
ogg
It's worth trying.
By the way does anyone want to share their customized Vi features with
respect to python. I am pretty much satisfied with my own but there is
always scope for improvements.
On
@steve
Thanks :)
On Mon, Feb 8, 2010 at 12:15 PM, steve st...@lonetwin.net wrote:
Hi Shashwat,
On 02/06/2010 11:20 PM, Shashwat Anand wrote:
here is the bpython screencast : http://*bpython*-
interpreter.org/static/*
bpython*-screencast01.
ogg
It's worth trying.
+1. (Having tried
rant Companies coming for hiring (campus-placement) never look the
knowledge of python as an additional advantage. Infact none of them care. I
check-listed the profile of all the 20+ companies which came and none of
them had to deal with anything python (except google, amazon, directi) and
even
On the other hand, I would like to point out that to really, really improve
your DS/Algo skills (two of the most important skills for a CS graduate,
IMO), python is a great language. You can learn, and prototype, and
experiment much faster than if you were to try the same thing in Java/C/C++
Give some more details.
Possible scenarios :
1 You are using a webclient such as webchat.freenode.net which is not
allowed by that channel
sol - use IRC clients
2 You are not authenticated and that channel does not permit
unauthenticated nicks
sol - authenticate your nick
3 You use a public ip
59.93.15.10 seems like a dynamic IP. best workaround can be to flush that IP
address. restarting the network may help (a wild guess)
On Sat, Feb 13, 2010 at 10:54 AM, Shashwat Anand
anand.shash...@gmail.comwrote:
Give some more details.
Possible scenarios :
1 You are using a webclient
Best of luck to everyone going to pycon. I will miss it very much though :(
On Mon, Feb 15, 2010 at 9:25 AM, Baiju M mba...@zeomega.com wrote:
Hi Senthil,
Last year your tutorial was very well received. All the best for this
time also ! Best wishes for others also. Enjoy maadi !
On
Hi Yuvi,
I had not decided yet but will apply for PSF most probably.
Abhishek(ideamonk) will go for Sahana perhaps (he had done some major work
during haiti-issue). Anand B.Pillai is planning to be a mentor this year
from BangPypers AFAIK but am not too sure about organization. Also
PyCon,2010 is
It can be called just once too...
def foo():
... print called
... return 0
...
1 foo() and foo() 3
called
False
This is because AND operator short-circuits. So when 1 foo() is false, it
terminates then and there. Srinivas is correct here.
~l0nwlf
-- Forwarded message --
From: Greg Lindstrom gslindst...@gmail.com
Date: Fri, Feb 26, 2010 at 7:53 PM
Subject: PyCon 2011 - Call for Tutorial Volunteers
To: python-l...@python.org, python-announce-l...@python.org
PyCon 2010 is complete and plans for PyCon 2011 in Atlanta have
In what might be his last Joel on Software post (for awhile, at least)
http://www.joelonsoftware.com/items/2010/03/17.html
Summary:
Early 2009: Joel disses DVCSes. His programmers switch from subversion to
hg. Joel grumbles. His programmers develop an hg-related product. Joel takes
a better look.
Just one question ? Why Idle after all ?
On Tue, Mar 30, 2010 at 3:41 PM, Srinivas Reddy Thatiparthy
srinivas_thatipar...@akebonosoft.com wrote:
Probably this link could help.
Anyway, i am not sarcastic about your question,
http://www.google.co.in/search?q=idle+font+size+mac
ThanksRegards,
A good news for fellow bangPypers, David Beazley is visiting bangalore.
PS Residing in Allahabad sucks big time :(
~l0nwlf
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
10 - 15th may, the time when my ends-sem exams will be going on :(
Will miss this, but best of luck to all who attend the meet.
On Wed, Apr 28, 2010 at 6:24 PM, Noufal Ibrahim nou...@gmail.com wrote:
On Wed, Apr 28, 2010 at 6:22 PM, Noufal Ibrahim nou...@gmail.com wrote:
There are around 10
I used 'mechanize' to write a script which automatically login to SPOJ
website and download submitted solution.. Not sure if it can fill the form
too.
On Wed, Jun 9, 2010 at 11:39 AM, Venkatraman S venka...@gmail.com wrote:
On Wed, Jun 9, 2010 at 11:33 AM, Kenneth Gonsalves law...@au-kbc.org
On Tue, Jul 13, 2010 at 8:00 PM, Vikram kp...@rediffmail.com wrote:
Suppose you have two nested lists, X and Y.
A sample element of X is:
['NM_032291', '6741', '6751', 'chr1', '+']
Another sample element of X is:
['NM_001097', '51183080', '51183635', 'chr22', '+']
A sample
On Wed, Jul 14, 2010 at 9:01 AM, Shashwat Anand anand.shash...@gmail.comwrote:
On Tue, Jul 13, 2010 at 8:00 PM, Vikram kp...@rediffmail.com wrote:
Suppose you have two nested lists, X and Y.
A sample element of X is:
['NM_032291', '6741', '6751', 'chr1', '+']
Another sample
On Thu, Jul 22, 2010 at 3:21 PM, Vikram kp...@rediffmail.com wrote:
Suppose you have the following list:
x =[['cat',10],['cat',20],['cat',30],['dog',5],['dog',1],['dog',3]]
My problem is that i wish to obtain the following two dictionaries:
xdictstart = {'cat':10, 'dog':1}
xdictend =
On Thu, Jul 22, 2010 at 10:37 PM, Shekhar Tiwatne pytho...@gmail.comwrote:
On Thursday 22 July 2010 09:36 PM, Anand Balachandran Pillai wrote:
On Thu, Jul 22, 2010 at 7:00 PM, stevest...@lonetwin.net wrote:
Hi,
On 07/22/2010 05:02 PM, Anand Balachandran Pillai wrote:
On Thu, Jul
BTW the problem is known as 3n+1 problem and you can find it in ACM archives
too.
http://uva.onlinejudge.org/index.php?option=com_onlinejudgeItemid=8category=3page=show_problemproblem=36
___
BangPypers mailing list
BangPypers@python.org
On Fri, Jul 23, 2010 at 1:51 PM, Baishampayan Ghose b.gh...@gmail.comwrote:
Emil,
Below given is solution to a puzzle(
http://projecteuler.net/index.php?section=problemsid=14) in python and
c
Python:
import time
startT=time.time()
maxlen=0
longest=0
for i in
On Sun, Aug 1, 2010 at 1:04 PM, Senthil Kumaran orsent...@gmail.com wrote:
On Sun, Aug 01, 2010 at 12:00:33PM +0530, Zubin Mithra wrote:
I was wondering if any of the speakers would be interested in taking the
lead.
If you would like hack around. Bring in your laptop and if the
On Fri, Aug 6, 2010 at 8:37 PM, Pradeep Gowda prad...@btbytes.com wrote:
On Fri, Aug 6, 2010 at 10:45 AM, Shashwat Anand
anand.shash...@gmail.com wrote:
I would prefer LC anyway:
sum(i for i in range(0,10,2))
20
why use LC at all?
sum(range(0,10,2))
Oops. Wrong choice of example
On Wed, Aug 18, 2010 at 10:58 PM, Anand Shankar anand_shan...@yahoo.comwrote:
During a tutorial python session with my colleagues I was presented with a
basic
question
d = {'apple':2,'banana':5, 'coke': 6}
print d.keys()
['coke', 'apple', 'banana']
Question is why does it not return
On Thu, Aug 19, 2010 at 10:31 AM, Sahasranaman MS sah...@naman.ms wrote:
On Thursday 19 August 2010 07:08 AM, Kenneth Gonsalves wrote:
On Wed, 2010-08-18 at 10:28 -0700, Anand Shankar wrote:
I have no clues. Any inputs??
sort order of dictionary keys is not guaranteed. Only a list will
37 matches
Mail list logo