Re: [Tutor] How to get value of sublist as return to verify in other file

2015-01-05 Thread Alan Gauld
On 05/01/15 17:38, shweta kaushik wrote: list = [[1,2,3,4,5],[2,3,4,4,6],[3,4,5,4,6],[1,4,5,4,8]] for sublist in list: ... if sublist[3] == 4: ...print sublist[3] ... 4 4 4 4 I want sublist[3] value when matched first time and don't want the value for second match. You need to bre

Re: [Tutor] How to get value of sublist as return to verify in other file

2015-01-05 Thread Steven D'Aprano
On Mon, Jan 05, 2015 at 11:08:16PM +0530, shweta kaushik wrote: > Hi All, > > I need help for list. > > I am having one list of list > > list = [[1, 2, 3, 4], [1, 5, 9, 11,5], [1, 6, 7, 2]] > > In this list i am getting sublist value as shown below: > > >>> list = [[1,2,3,4,5],[2,3,4,4,6],[3,

[Tutor] How to get value of sublist as return to verify in other file

2015-01-05 Thread shweta kaushik
Hi All, I need help for list. I am having one list of list list = [[1, 2, 3, 4], [1, 5, 9, 11,5], [1, 6, 7, 2]] In this list i am getting sublist value as shown below: >>> list = [[1,2,3,4,5],[2,3,4,4,6],[3,4,5,4,6],[1,4,5,4,8]] >>> for sublist in list: ... if sublist[3] == 4: ...

Re: [Tutor] Improving My Simple Game Code for Speed, Memory and Learning

2015-01-05 Thread Danny Yoo
Apologies; haven't had time to look at this thread carefully yet. Busy start of the new year. :P Minor comment: you can improve this snippet: if total == 17 or total == 21 or total == 28 or total == 29 or \ total == 31 or total == 42 or total == 45 or total == 46 \ or

Re: [Tutor] Improving My Simple Game Code for Speed, Memory and Learning

2015-01-05 Thread Mark Lawrence
On 03/01/2015 18:15, WolfRage wrote: On 01/03/2015 06:58 AM, Dave Angel wrote: self.transposed_grid = zip(*self.grid) zip() sounds confusing. But I am going to try this and see what it gives me. But Somehow I think it will require me to understand yield, which I still do not totally get how to

Re: [Tutor] Fwd: Newbie

2015-01-05 Thread Mark Lawrence
On 02/01/2015 18:21, Rohan Ds wrote: -- Forwarded message -- From: "Rohan Ds" Date: 2 Jan 2015 23:46 Subject: Newbie To: Cc: Hello everybody :) I am Rohan from India. I'm new to Python. I have a basic understanding as to how Python works. I want to contribute to PSF. The inform

Re: [Tutor] threading in python 2.7 - 2nd version

2015-01-05 Thread Rance Hall
Cameron: This was the exact issue, and I had initially suspected as much, but had no idea how to fix it. I had tried to use the global variable directive, but as it turned out I had misused it. Anyway, everything is working as it should. Thanks Rance On Mon, Jan 5, 2015 at 12:39 AM, Cameron S

Re: [Tutor] Could you look over my code?

2015-01-05 Thread Steven D'Aprano
On Sun, Jan 04, 2015 at 09:53:37PM -0600, boB Stepp wrote: > On Sun, Jan 4, 2015 at 8:39 PM, Steven D'Aprano wrote: [...] > > Don't be distressed! You've just stumbled across a small difference > > between Python version 2 and version 3. In Python 3, you should use > > "raw_input" instead of "inpu

Re: [Tutor] threading in python 2.7 - 2nd version

2015-01-05 Thread Joseph Lee
Hi, My answers are below. -Original Message- From: Tutor [mailto:tutor-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Rance Hall Sent: Sunday, January 4, 2015 9:20 PM To: tutor Subject: [Tutor] threading in python 2.7 - 2nd version Thanks to the advice from Joseph and Alan, I