0

This is related to the problem in hackerrank : https://www.hackerrank.com/challenges/grid-challenge/problem

While trying to read in the following matrix as input

ebacd
fghij
olmkn
trpqs
xywuv

I used this code :

grid = [[k for k in input().strip()]for l in range(nn)]

Where nn is the dimension of the square matrix

But I get the following error [Runtime Error]

Traceback (most recent call last):
File "solution.py", line 9, in <module>
for k in input().strip():
File "<string>", line 1, in <module>
NameError: name 'eabcd' is not defined

Question : How to solve the error , or better yet How to input the given matrix ?

Ayan Mitra
  • 497
  • 1
  • 8
  • 20

0 Answers0