INVALID SYNTAX ERROR for 'else' statement in python -


i trying write quicksort program in python, i'm getting invalid syntax error @ else statement in second last line below:

import random  n=int(raw_input("enter size of list: ")) # size of list intlist = [0]*n num in range(n):     intlist[num]=random.randint(0,10*n)  pivot=random.choice(intlist) list_1=[] # list of elements smaller pivot list_2=[] # list of elements greater pivot  num in range(n):     if num<=pivot:         list_1.append(num)     else         list_2.append(num) 

this not complete program still writing.

add colon after else looks else:. , pick tutorial ;)


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -