program to check if word starts & ends with same letter
def match_letter():
count = 0
for word in words:
if len(word) >=2 and word[0] == word[-1]:
count = count + 1
return count
def main():
words = []
words_list = raw_input('Enter Words: ')
words_list = words_list().split()
for word in words_list:
words.append(word)
count = match_letter()
print 'letter matched %d ' %count
if __name__ == '__main__':
main()
this is my python code, giving an error
Traceback (most recent call last):
File "D:\Programming\Python\Python 2.7\same_letter.py", line 21, in <module>
main()
File "D:\Programming\Python\Python 2.7\same_letter.py", line 13, in main
words_list = words_list().split()
TypeError: 'str' object is not callable
i am very thankful if anyone can help me..