Question

In: Computer Science

CALM = ['good', 'safe', 'well', 'benefit', 'ok'] And some possible worried words: WORRIED = ['bad', 'risk',...

CALM = ['good', 'safe', 'well', 'benefit', 'ok'] And some possible worried words: WORRIED = ['bad', 'risk', 'risky', 'nervous', 'problem'] Make sure all of your words are lowercase, and that each string is a word and not a phrase -- keeps things simpler. Now weight the words from the above lists. We’ve started out with lists of calm/worried words, but some of them are stronger than others. For example, the word good is probably more positive than the word ok. Assign a weight to each word in your lists. Use positive weights for calm words and negative weights for worried words. Your lists should be 2-dimensional now, in this format: [[word, weight], [word, weight]...] Use list concatenation (+) to create one big list instead of two separate ones, something like this: ALL_WORDS = CALM + WORRIED Iterate over this new 2-dimensional list and print out each word and its corresponding weight.

(Script for ATOM or REPL to be run)

Solutions

Expert Solution

Find the code for the above question below, read the comments provided in the code for better understanding. If found helpful please do upvote this.
Please refer to the screenshot of the code to understand the indentation of the code.

Code

CALM = [['good', 5], ['safe', 2], ['well', 4], ['benefit', 3], ['ok', 1]]

WORRIED = [['bad', -2], ['risk', -4], ['risky', -5], ['nervous', -1],

['problem', -3]]

BIG_LIST = CALM + WORRIED

#now iterate each item in big list

for item in BIG_LIST:

print(item[0]," : ",item[1])

Screenshot

Output


Related Solutions

Discuss that how it is possible that a company is bad in solvency but good in...
Discuss that how it is possible that a company is bad in solvency but good in liquidity? Justify your Answer with example. Explain in 300 or more words.
Is globalization of health care good or bad for patients? Who might benefit from the globalization...
Is globalization of health care good or bad for patients? Who might benefit from the globalization of health care? Who might lose?
Is government debt good or bad? Please answer in 250 words or more.
Is government debt good or bad? Please answer in 250 words or more.
Government policies and laws on products and inputs are good or bad? (300- 500 words )...
Government policies and laws on products and inputs are good or bad? (300- 500 words ) as specific as possible.
The efficient frontier is composed of the best possible combinations of risk and return for well...
The efficient frontier is composed of the best possible combinations of risk and return for well diversified portfolios. As a result, the investor should always choose the portfolio on the efficient set that maximizes the Sharpe ratio. In a world of positive transaction costs how often should a portfolio manager rebalance their portfolio to make sure it is on the efficient frontier?
Explain the statement, "risk by itself is never bad or good." What does this mean? Why...
Explain the statement, "risk by itself is never bad or good." What does this mean? Why is it true?
Fill in these missing words in the following statements. Some possible words are given as follows....
Fill in these missing words in the following statements. Some possible words are given as follows. reject, Type I error, p-value, parameter, null hypothesis, Type II error, test statistic (a) A statistical hypothesis is a hypothesis concerning a of a population or distribution. (b) If a test is devised to detect a change in some standard or prevailing value for the parameter in question, then the hypothesis of no change is generally labeled the hypothesis. (c) The error of rejecting...
Inflation is both good and bad for us. Identify two ways/causes/reasons that inflation can benefit you...
Inflation is both good and bad for us. Identify two ways/causes/reasons that inflation can benefit you personally. And, identify two reasons/causes/ways that inflation harms you personally. Try to think outside the box on this one.
What are some examples of good debt vs. bad debt? Please, include an explanation.
What are some examples of good debt vs. bad debt? Please, include an explanation.
I took an online sorting set. I categorized good and bad words with images of Fat...
I took an online sorting set. I categorized good and bad words with images of Fat people and Thin people. My data suggest a strong automatic preference for Thin people over Fat people. I was Using two keys on the keyboard which swapped after a session that was timed. Name one potential reliability and one validity problem of the test
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT