user4646333
user4646333

Reputation: 11

How to find the position of letters in a list of words?

In a list of words :

ACQUIRED
ALMANAC
INSULT
JOKE
HYMN
GAZELLE
AMAZON
EYEBROWS
AFFIX
VELLUM

for e.g.:How do I find the position of an 'A'; it could be any 'A'

Upvotes: 0

Views: 53

Answers (1)

Bubai
Bubai

Reputation: 280

def find_A(input):
    for i, c in enumerate(input):
        if c == 'A': yield i

will return the character position of all the As

Upvotes: 1

Related Questions