1 def negCount (negativeWords): count=0 ∞assENA for word in wordBag: if word in negativeWords: count-count+1 print("there are ",count, "negative words") 1 negCount (negativeWords) there are 0 negative words

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

Given a txt word list and an array in Python how do you count the number of words that BOTH THE WORD LIST AND THE ARRAY share? Attatched is my code. Trying to understand where i'm going wrong.

:
:
1 def negCount (negativeWords):
count=0
for word in wordBag:
N345678
2
if word in negativeWords:
count=count+1
print("there are ",count, "negative words")
1 negCount
(negativeWords)
there are negative words
Transcribed Image Text:: : 1 def negCount (negativeWords): count=0 for word in wordBag: N345678 2 if word in negativeWords: count=count+1 print("there are ",count, "negative words") 1 negCount (negativeWords) there are negative words
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT