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 following code outputs the number of words whose first and last letters are equal. Tested and verified using a python online compiler:
words = ['aba', 'xyz', 'xgx', 'dssd', 'sdjh'] count = 0 for i in words: if i[0]==i[-1]: count = count + 1 print(count)
Output:
$python main.py 3