Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Steven D'Aprano
Alan Gauld wrote: Hi Emile, On 26/06/12 00:26, Emile van Sebille wrote: Try using the operator that checks for equality such as if w[0] == 'x': This does the same thing and works even when w is an empty string. Umm, so does startswith()? Can you clarify what you mean by the last sentence?

Re: [Tutor] Working with lists - why does my script not work?

2012-06-25 Thread ALAN GAULD
CCing the list, please use replyAll when responding to the list.   By the way for some reason, the google class says that the functions sorted() is better than the method list.sort(). > > > >" list.sort() -- sorts the list in place (does not return it). (The sorted() >function shown below is pref

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Alan Gauld
Hi Emile, On 26/06/12 00:26, Emile van Sebille wrote: Try using the operator that checks for equality such as if w[0] == 'x': This does the same thing and works even when w is an empty string. Umm, so does startswith()? Can you clarify what you mean by the last sentence? -- Alan G Author

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Alan Gauld
On 25/06/12 23:12, Mike Nickey wrote: I did the same exercise so maybe I can assist here. From what I see, the line... if w.startswith('x'): seems to be ineffective. If that's true you have a seriously broken version of Python! startswith() is a better idiom because it conveys the intent much

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Emile van Sebille
On 6/25/2012 3:12 PM Mike Nickey said... The problem with this code is that it only gets the first word beginning with x and the others remaisn on the original list, sorted at the end. I've tested on terminal many parts of the code and it whas fine, but when I run it complete, it does not work.

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-25 Thread Mike Nickey
Good luck! >> >> To download all the exercises, access: >> http://code.google.com/edu/languages/google-python-class/google-python-exercises.zip >> >> >> Thank y'all. >> >> >> >> > -- next part -- > An HTML attachment wa

Re: [Tutor] Working with lists - why does my script not work?

2012-06-25 Thread Alan Gauld
On 25/06/12 14:39, Puneeth Chaganti wrote: `sorted`[0] returns a new list unlike `sort`[1], which sorts a list in-place. Something like this, would work: words = sorted(words) x_list = sorted(x_list) or just words.sort() x_list.sort() which will work in place as mentioned above. -- Alan G

Re: [Tutor] List Methods, String Slices and For loops

2012-06-25 Thread Walter Prins
Hi, Just one tangential comment: On 25 June 2012 14:33, Developer Ecofunds wrote: > I'm using python 2.5 because it's the one works with Google App Engine > GAE works with Python 2.7 also: https://developers.google.com/appeng

Re: [Tutor] List Methods, String Slices and For loops

2012-06-25 Thread Craig Cesareo
In case you didn't get my reply on the previous message... Try putting.[:] After "words" in the for loop line. What's happening is you're removing words from the list you are iterating through and it's messing with the loop. The empty indice I'm having you insert makes an in place copy

Re: [Tutor] Working with lists - why does my script not work?

2012-06-25 Thread Puneeth Chaganti
On Mon, Jun 25, 2012 at 6:51 PM, Developer Ecofunds wrote: > Hello guys, > > I'd like to ask you a little question about a script I did and isn't working > properly. > It is one excercise from googles python classes > > > I'm u

Re: [Tutor] Working with lists - why does my script not work?

2012-06-25 Thread Kwpolska
On Mon, Jun 25, 2012 at 3:21 PM, Developer Ecofunds wrote: > I'm using python 2.5 because it's the one works with Google App Engine > Not quite. > Note: If you are starting a new project, it is recommended that you use the >

Re: [Tutor] List Methods, String Slices and For loops

2012-06-25 Thread Developer Ecofunds
Soory by the new message with same question. The goup said my subject was messy and the previous message was denied. Please ignore. 2012/6/25 Developer Ecofunds > Hello guys, > > I'd like to ask you a little question about a script I did and isn't > working properly. > It is one excercise from g

[Tutor] List Methods, String Slices and For loops

2012-06-25 Thread Developer Ecofunds
Hello guys, I'd like to ask you a little question about a script I did and isn't working properly. It is one excercise from googles python classes < http://code.google.com/edu/languages/google-python-class/set-up.html> I'm using python 2.5 because it's the one works with Google App Engine < https

Re: [Tutor] Working with lists - why does my script not work?

2012-06-25 Thread Craig Cesareo
Try putting.[:] After "words" in the for loop line. What's happening is you're removing words from the list you are iterating through and it's messing with the loop. The empty indice I'm having you insert makes an in place copy of the list so your remove doesn't effect it. -- Craig Ces

[Tutor] Working with lists - why does my script not work?

2012-06-25 Thread Developer Ecofunds
Hello guys, I'd like to ask you a little question about a script I did and isn't working properly. It is one excercise from googles python classes < http://code.google.com/edu/languages/google-python-class/set-up.html> I'm using python 2.5 because it's the one works with Google App Engine < https

Re: [Tutor] Tkinter message box

2012-06-25 Thread Alan Gauld
On 25/06/12 03:00, ken wrote: If this belongs on another list, please let me know. I am using PYTHON 3 and tkinter. I have been playing around with messagebox. Is there any way I can display the value of a variable inside a message box? Yes, just insert it intro the message string prior to dis