newbie question (for loop)

Chris Rebert clp2 at rebertia.com
Tue Mar 15 04:17:42 EDT 2011


On Tue, Mar 15, 2011 at 1:01 AM, Sachin Kumar Sharma <SSharma84 at slb.com> wrote:
> 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))
>                                          ^
> SyntaxError: invalid syntax

You forgot the required colon (":"). It should be

for i in range(len(list)): # note trailing colon

Cheers,
Chris
--
"BB"?
http://blog.rebertia.com



More information about the Python-list mailing list