Answer to Question #335473 in Python for Kiran

Question #335473

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)]


1
Expert's answer
2022-04-29T11:29:34-0400
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS