Python: Converting word to list of letters, then returning indexes of the letters against lower case alphabet
<p>I have already completed the task but in its most basic form looking for help shortening it and so it can apply to any word not just one with eight letters, here's what I've got so far (bit long for what it does):</p>

<pre><code>alpha = map(chr, range(97, 123))
word = "computer"
word_list = list(word)

one = word[0]
two = word[1]
three = word[2]
four = word[3]
five = word[4]
six = word[5]
seven = word[6]
eight = word[7]


one_index = str(alpha.index(one))
two_index = str(alpha.index(two))
three_index = str(alpha.index(three))
four_index = str(alpha.index(four))
five_index = str(alpha.index(five))
six_index = str(alpha.index(six))
seven_index = str(alpha.index(seven))
eight_index = str(alpha.index(eight))

print (one + "=" + one_index)
print (two + "=" + two_index)
print (three + "=" + three_index)
print (four + "=" + four_index)
print (five + "=" + five_index)
print (six + "=" + six_index)
print (seven + "=" + seven_index)
print (eight + "=" + eight_index)
</code></pre>

<p>What you are probably looking for is a <strong>for-loop</strong>.</p>

<p>Using a for-loop your code could look like this:</p>

<pre><code>word = "computer"

for letter in word:
  index = ord(letter)-97
  if (index&lt;0) or (index&gt;25):
    print ("'{}' is not in the lowercase alphabet.".format(letter))
  else:
    print ("{}={}".format(letter, str(index+1))) # +1 to make a=1
</code></pre>

<p>If you use</p>

<pre><code>for letter in word:
  #code
</code></pre>

<p>the following code will be executed for every letter in the word (or element in word if word is a list for example).</p>

<p>A good start to learn more about loops is here: <a href="https://en.wikibooks.org/wiki/Python_Programming/Loops" rel="nofollow">https://en.wikibooks.org/wiki/Python_Programming/Loops</a></p>

<p>You can find tons of ressources in the internet covering this topic.</p>

python string list