Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread spir
On 01/22/2014 05:24 AM, Adam Hurwitz wrote: Hi, This is a coding challenge in the Google Developers Python Coursehttps://developers.google.com/edu/python/exercises/basic. I have been working on this challenge for hours without being able to solve. A. match_ends # Given a list of strings,

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Dave Angel
Adam Hurwitz adamhurw...@google.com Wrote in message: Many times when a function doesn't work, and you can't figure out why, it pays to factor the function, at least temporarily, and test the different parts. This might be your best bet in this case, especially when I tell you that

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Steven D'Aprano
On Tue, Jan 21, 2014 at 08:24:54PM -0800, Adam Hurwitz wrote: Hi, This is a coding challenge in the Google Developers Python Coursehttps://developers.google.com/edu/python/exercises/basic. I have been working on this challenge for hours without being able to solve. A. match_ends # Given

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Alan Gauld
On 22/01/14 04:24, Adam Hurwitz wrote: A. match_ends # Given a list of strings, return the count of the number of # strings where the string length is 2 or more and the first # and last chars of the string are the same. Notice that you are asked to *return* a number not print it. Also notice

[Tutor] how to send ctrl+a+c with python

2014-01-22 Thread lei yang
Hi expert, I want to use pexpect to send ctrl+a+c how should I do? self.vm_session.sendline() how to fill ??? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] how to send ctrl+a+c with python

2014-01-22 Thread eryksun
On Wed, Jan 22, 2014 at 8:49 AM, lei yang yanglei.f...@gmail.com wrote: I want to use pexpect to send ctrl+a+c What's ctrl+a+c? If this is for screen, then I think you mean ctrl+a c: sendcontrol('a') send('c') ___ Tutor maillist -

Re: [Tutor] how to send ctrl+a+c with python

2014-01-22 Thread lei yang
thanks, it works for me Lei On Wed, Jan 22, 2014 at 10:35 PM, eryksun eryk...@gmail.com wrote: On Wed, Jan 22, 2014 at 8:49 AM, lei yang yanglei.f...@gmail.com wrote: I want to use pexpect to send ctrl+a+c What's ctrl+a+c? If this is for screen, then I think you mean ctrl+a c:

Re: [Tutor] Stuck on Challenge in Google Python Class

2014-01-22 Thread Keith Winston
On Wed, Jan 22, 2014 at 6:40 AM, Alan Gauld alan.ga...@btinternet.com wrote: else: return ' ' Notice that this return will throw you out of the function so you don't process any more strings. You might like to look at 'continue' as an alternative. You actually don't need to do

Re: [Tutor] when is pythondontwritebytecode useful?

2014-01-22 Thread eryksun
On Tue, Jan 21, 2014 at 2:44 PM, Albert-Jan Roskam fo...@yahoo.com wrote: Hmmm, number of OS * number of Python versions = a lot of packages. Isn't a .zip file easiest? Or maybe msi or wininst*) on Windows and .deb on Linux (with alien that can easily be converted to e.g. rpm). The egg format

[Tutor] iter class

2014-01-22 Thread Keith Winston
I'm working my way through some of the examples in http://ivory.idyll.org/articles/advanced-swc/#list-comprehensions And tried this one: class MyTrickyIter: ... def __init__(self, thelist): ... self.thelist = thelist ... self.index = -1 ... ... def __iter__(self): ... return

Re: [Tutor] iter class

2014-01-22 Thread Devin Jeanpierre
On Wed, Jan 22, 2014 at 8:57 PM, Keith Winston keithw...@gmail.com wrote: I'm working my way through some of the examples in http://ivory.idyll.org/articles/advanced-swc/#list-comprehensions And tried this one: class MyTrickyIter: ... def __init__(self, thelist): ... self.thelist =

Re: [Tutor] iter class

2014-01-22 Thread Keith Winston
On Thu, Jan 23, 2014 at 12:21 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: in Python 3, it should be __next__, not next. Ah! That's it! Thanks!!! I'd suggest staying away from any old blog posts and articles, unless you'd care to learn Python 2.x instead of 3.x. ;) Yeah, but this is a