TypeError: 'str' object is not callable (python 2) -
To start the program if the program starts & amp; The same letter ends with
def match_letter (): count = 0 for the word in words: if len (word)> = 2 and the word [0] == word [- 1]: Count words in the list of words: words.append (word) count = match_letter () = count = 1 return count def main (): word = [] words_list = raw_input ('enter word:') words_list = Word_list (). This is my Python code, this is error traceback (most recent call final): file "D: \ Programming \ Python Python 2.7 \ Same_letter.py ", line 21, & lt; Module & gt; Main () file "D: \ Programming \ Python \ Python 2.7 \ same_ letter.py", line 13, key words_list = words_list (). Split () type error: 'str' is not worth the object corner
I am very grateful if someone can help me ..
< Div class = "post-text" itemprop = "text">
This line is an additional parenthesis
words_list = word_list (). It may just be
words_list = words_list.split ()
Actually, You have several external steps, your code block
words = [] words_list = raw_input ('enter the word:') word_list = word_list (). For word in split () words: word .append (word)
may be:
word = raw_input ('enter the word: ') .split ()
And if I understand your question, then I solve it by using slicing
def same_back_and_front (s) : Returns S [0] == S [-1] # is equal to the last letter of the first letter & gt; & Gt; & Gt; Word = ['hello', 'test', 'or', 'nop']> gt; & Gt; & Gt; [Words for words in words same_back_and_front (word)] ['test', 'yay']
Comments
Post a Comment