On Mar 30, 2012, at 9:41 AM, Eric Kangas wrote:

> Hi,
> 
> I am trying to find the values, and locations of those values in a sequence 
> of numbers. I have written up code that I thought would work, but it doesn't. 
> Here is the code:
> 
> l31 = [len(l3[i]) for i in range(a/len(l))];
> l32 = [];
> l33 = [if x=6: l32.append((x,l31[x])) for x in l31];
> 
> I get the normal invalid syntax error. What am I missing in this code for the 
> line with l33 = ?
> 
When I encountered a similar problem (an if-statement in a list comprehension), 
I eventually solved my problem with the python filter function — I suggest you 
look it up.

I wish you well.
Jim Clark

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to