私はPython2.7で書いています。指示を呼び出すときに送る変数を ">"作る方法を理解する必要があります。この関数を何回か呼び出す必要があり、時には "<"になる必要があります。Python2.7の関数で変数を送る方法
sentiment_point = giving_points(index_focus_word, 1, sentence, -2)
def giving_points(index_focus_word, index_sentiment_word, sentence, location):
if index_focus_word > index_sentiment_word:
sentiment_word = sentence[index_focus_word + location]
私がしたいことを以下に示してみましたが、動作しません。
sentiment_point = giving_points(index_focus_word, ">", 1, sentence, -2)
def giving_points(index_focus_word, sign, index_sentiment_word, sentence, location):
if index_focus_word sign index_sentiment_word:
sentiment_word = sentence[index_focus_word + location]
コードをハイライト表示し、インラインエディタの上部にある「{}」を押してコードをフォーマットしてください。 – Oisin