Im new to python and i need some help with this.
TASK : given a list --> words = [\'aba\', \'xyz\', \'xgx\', \'dssd\', \'sdjh\']
words = [\'aba\', \'xyz\', \'xgx\', \'dssd\', \'sdjh\']
i need to com
The reason is that in your second example i is the word itself, not the index of the word. So
i
for w1 in words: if w1[0] == w1[len(w1) - 1]: c += 1 print c
would the equivalent of your code.