[Tutor] how to remove the coming duplication

delegbede at dudupay.com delegbede at dudupay.com
Thu Nov 10 08:38:40 CET 2011


You have the error because the square brackets are missing. You should have done this:
 b=[b.append(a[i]) for i in range(len(a)) if a[i] != b[-1]]

This would however give you an index out of range error. 

That said, may I ask what it is exactly you are trying to achieve?

Cheers. 
Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: lina <lina.lastname at gmail.com>
Sender: tutor-bounces+delegbede=dudupay.com at python.org
Date: Thu, 10 Nov 2011 15:20:49 
To: tutor<Tutor at python.org>
Subject: Re: [Tutor] how to remove the coming duplication

b = []

 b=b.append(a[i]) for i in range(len(a)) if a[i] != b[-1]

showed me:
SyntaxError: invalid syntax
_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list