Q:

Python, find a word and the location of each character in that word in a string

Let's say in Python I have this sentence:
my_sentence = "I like to drive my car around the round block twice daily"

And I want to find the word 'round' in this sentence. I know I can use find, index, rfind, and rindexlike so:
print my_sentence.find('round')
>>>24

What I want to do is find the location of each letter in 'round' within the sentence and only use the first occurrence of the word 'round'. I would like it to print out the location of each letter of 'round' within the string. I've tried to do this (for example, finding the last letter and going from there):
last_letter = my_sentence.find('round')
last_letter2 = last_letter[-1::]

This produces an error. So, what's the best way of getting the location of each letter of a word that exists in a string? I'm new to Python and I saw there was ways to find where a word was, but not each letter of the word in the string. How do I do this?
Expected output in parenthesis:
r (location 24) o (25) u (26) n(27) d(28)

A:

Simple: Just find the first occurrence of the word, then add offsets for the letters.
>>> my_sentence = "I like to drive my car around the round block twice daily"
>>> word = 'round'
>>> pos = my_sentence.find(word)
>>> [(c, pos + i) for (i, c) in enumerate(word)]
[('r', 24), ('o', 25), ('u', 26), ('n', 27), ('d', 28)]

