Take two a list of strings as input in Python -


i'm new python , i'm trying take list of strings input using list comprehensions. here i've tried , gives me errors.

m,n = raw_input().strip().split()  matrix = [ [str(in) in in raw_input().strip()] in xrange(n)]  print matrix 

it supposed receive list of strings (sth 2d m x n array in c). giving me error syntaxerror: invalid syntax.

in keyword. you're using here thinking it's variable.:

matrix = [[str(in) in in raw_input().strip()] in xrange(n)] 

it's syntaxerror because python thinks you're saying in twice, when you're intending different. change in name.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -