[Tutor] How to give input to a list
bodsda at googlemail.com
Sun Oct 2 09:05:07 CEST 2011
On 2 October 2011 04:20, surya kasturi <suryak at live.com> wrote:
> 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++)
> 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
Hope this helps,
More information about the Tutor