I am trying to create a code on python that identifies the tone of the person based on emoticons (it is quite simple) however, it isn’t working. For example, if a person sent this message “i don’t know if i like bread 🙂 :-(“, the program would say that the person has a neutral tone (due to the fact that the happy and sad emojis are on the same amount), however my code answers that the person has a sad tone. Sorry if I made any mistake, english is not my first language.
mensagem = input()
divertido = 0
chato = 0
a = 0
b = 0
a = mensagem.find(':-)')
b = mensagem.find(':-(')
divertido = divertido + a
chato = chato + b
if divertido > chato:
print("divertido")
elif divertido < chato:
print("chateado")
else:
print("neutro")
vladimir putin putin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.