Write a program to print the following,
Sample Input1
after
4
a b c d
f e f g
t e r r
a b i j
Sample Output1
[(0, 0), (1, 0), (2, 0), (2, 1), (2, 2)]
line = []
search_line = input("What are you looking for? ")
number = int(input("Enter search field size: "))
print("#####################################")
print("Enter the letters of the search field")
for i in range(number):
line.append([])
line[i] = input("row number " + str(i) + ", (" + str(number) + " letters): ").split(' ')
print("#####################################")
coordinate = []
for el in range(len(search_line)):
for i in range(len(line)):
if search_line[el] in line[i]:
x = i
y = line[i].index(search_line[el])
coordinate.append((x, y))
break
print("ANSWER: ", end='')
print(coordinate)
Comments
Leave a comment