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 <[email protected]> Sender: [email protected] Date: Thu, 10 Nov 2011 15:20:49 To: tutor<[email protected]> 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 - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
