In Python 3, all input is converted to a string, so there is no need to use map.(1) The Python 3 input()
is equivalent to the Python 2 raw_input()
.(2)
The str.split()
string method, whenever no separator is specified, returns a list of words separated by any consecutive whitespace.(3) In this problem CLORGRID, strings are given without any whitespace. Therefore, given s = '..#'
,
s.split() = ['..#']
.
Line 12 of your Solution 1 is arr.append(list(map(str, input().split())))
.
For arr = []
and input '..#'
, this will result in arr = [['..#']]
To append a list of the individual characters of a string input to arr, I recommend using a list comprehension:
arr.append([c for c in input()])