small changes to fix output

This commit is contained in:
kaiyuran 2024-11-12 22:13:50 -05:00
parent 7622d8c68e
commit f2a23ebc5b

7
app.py
View file

@ -186,18 +186,17 @@ def emojify(message):
try: try:
formWord = word.lower() formWord = word.lower()
if formWord[-1] == ".": if formWord[-1] == ".":
finalMessage.append(word[:-1] + choiceWordDict[formWord[:-1]]+".") finalMessage.append(word[:-1] + (choiceWordDict[formWord[:-1]] * random.randint(1,3)) +".")
else: else:
finalMessage.append(word + choiceWordDict[word.lower()]) finalMessage.append(word + choiceWordDict[word.lower()])
# print("Emojified word is:",word)
except: except:
finalMessage.append(word) finalMessage.append(word)
pass pass
print(finalMessage) print(finalMessage)
final =" ".join([str(item) for item in finalMessage]) final =" ".join([str(item) for item in finalMessage])
# print(final)
return final return final
@ -216,7 +215,7 @@ def get_random_emoji():
final = emojify(message) final = emojify(message)
print(final) # print(final)
final = jsonify({"message": final})# emoji in JSON format final = jsonify({"message": final})# emoji in JSON format
# final = jsonify({final: 1})# emoji in JSON format # final = jsonify({final: 1})# emoji in JSON format