I am writing in Python2.7 and need to figure out how to make ">" a variable that I send in when I call for the directions. I need to call this function several times and sometimes it needs to be "<".
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]
I tried showing below what I want to do, but it does not work.
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]