newbie question (for loop)

Tim Morneau Tim.Morneau at nsc.com
Tue Mar 15 14:48:14 EDT 2011


You have to add the colon to the end of the statement if this is an 
accurate representation of the statement so:

"for  i  in  range(len(list)):"  instead of "for  i  in  range(len(list))"


On 3/15/2011 2:01 AM, Sachin Kumar Sharma wrote:
>
> BB,
>
> I am getting error on the following syntax while running in Ipython 
> and spyder and I failed to figure out why
>
> for  i  in  range(len(list))
>
> Error
>
> for  i  in  range(len(list))
>
>                                          ^
>
> SyntaxError: invalid syntax
>
> where list is a list defined as a collection of words and it is OK 
> prints fine.
>
> Kindly advise.
>
> Cheers
>
> Sachin
>
> *************************************************************************
> Sachin Kumar Sharma*
>
> Senior Geomodeler __
>

-- 

_______________________________

Timothy W. Morneau

/National Semiconductor/

Phone: (303) 845-4108

Fax:(303) 845-4005

email: Tim.Morneau at nsc.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110315/8fbd4d51/attachment-0001.html>


More information about the Python-list mailing list