On 2 October 2011 04:20, surya kasturi <sur...@live.com> wrote: > Hi, > > How give input to a list all at once. > I mean if we declared a array and like to take input for it > > for (i=0;i<5;i++) > scanf("%d",&array[i]); > here we can give input of 5 numbers with a space in command prompt. > > Similarly in python if i create a list and do similar process > > list = [ [ ], [ ] ] > for i in range (0,2): > for j in range (0, 2): > list[i].append ( int (raw_input()) ) > > here, I am expecting a list like > [ [1,2] , [3,4] ] > > but when I give 1,2,3,4 with space in command prompt at once, it shows error. > > How do i overcome this problem? > > Actually my problem goes to sudoku solver where i need to take input all at > once. What should i do ? >
Can you paste the traceback please, and elaborate slightly on what you mean by 'with a space in command prompt once'. Note that you will have to enter 1,2,3,4 individually 1<enter> 2<enter> 3<enter> 4<enter> Rather than 1,2,3,4<enter> Hope this helps, Bodsda _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor