python 3.x - When I use string,find[::] in another def, the string.find() says it's attribution doesn't work -


when use find() string.find[::] in def function, says says attribution error. why not work?

def parts(phrase):     space=phrase.find(' ')     first_word=phrase[0:space]     return first_word  def rest_of_phrase(phrase):     space=phrase.find(' ')     rest_of_phrase=phrase[space+1:]     return rest_of_phrase  def jesus_this_part_is_hard(first_word,rest_of_phrase):     total_num=len(rest_of_phrase)     count=0     savepoint=[]     while total_num<count:         in total_num:             if i==' ':                 savepoint+=[i]             count+=1     print(first_word," ")     x=savepoint[::-1]     in x:         if i==x[0]:             print(rest_of_phrase[i:]," ")             p=i         elif i!=x[0]:             print(rest_of_phrase[i:p],"")             p=i   def main():     phrase = input("enter phrase")     parts(phrase)     parts(rest_of_phrase)     jesus_this_part_is_hard(first_word,rest_of_phrase) 

the result got line 2, in parts space=phrase.find(' ')

attributeerror: 'function' object has no attribute 'find'

parts(rest_of_phrase) here rest_of_phrase function hence seeing error replace main function below , fix syntax errors (not sure logical errors)

def main()   phrase = input("enter phrase")   first_word = parts(phrase)   rest_of_phrase = rest_of_phrase(phrase)   jesus_this_part_is_hard(first_word,rest_of_phrase) 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -