From 149608b63f3368fc000a11a2ec3bc6714c56fdc1 Mon Sep 17 00:00:00 2001 From: Ramin RX7 <52785580+Ramin-RX7@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:53:15 +0330 Subject: [PATCH] Improve readability of python code --- 6-NLP/3-Translation-Sentiment/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/6-NLP/3-Translation-Sentiment/README.md b/6-NLP/3-Translation-Sentiment/README.md index 712ef731..9aee3bcb 100644 --- a/6-NLP/3-Translation-Sentiment/README.md +++ b/6-NLP/3-Translation-Sentiment/README.md @@ -115,19 +115,15 @@ quote2 = """Darcy, as well as Elizabeth, really loved them; and they were both e sentiment1 = TextBlob(quote1).sentiment sentiment2 = TextBlob(quote2).sentiment -print(quote1 + " has a sentiment of " + str(sentiment1)) -print(quote2 + " has a sentiment of " + str(sentiment2)) +print(f'"quote1" has a sentiment of {sentiment1}') +print(f'"quote2" has a sentiment of {sentiment2}') ``` You see the following output: ```output -It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want # of a wife. has a sentiment of Sentiment(polarity=0.20952380952380953, subjectivity=0.27142857142857146) - -Darcy, as well as Elizabeth, really loved them; and they were - both ever sensible of the warmest gratitude towards the persons - who, by bringing her into Derbyshire, had been the means of - uniting them. has a sentiment of Sentiment(polarity=0.7, subjectivity=0.8) +"quote1" has a sentiment of Sentiment(polarity=0.20952380952380953, subjectivity=0.27142857142857146) +"quote2" has a sentiment of Sentiment(polarity=0.7, subjectivity=0.8) ``` ## Challenge - check sentiment polarity