Python: why is the same syntax ok in one line but not in another?
<p>I'm a beginner having trouble with some code in Python.</p>

<p>Why is they line:</p>

<p>responseCount = 0</p>

<p>ok, but line:</p>

<p>if responseCount = 0:</p>

<p>not okay?  IDLE is giving me the syntax error at the '=' sign.  I have tried it with "===" but the doesn't work either.</p>

<p>Big thanks to whoever can help.</p>

<pre><code>import urllib.request

url = 'http://www.gutenberg.org/cache/epub/1342/pg1342.txt'
book = urllib.request.urlopen(url)
lines = book.readlines()
book.close()

finalLines = [line.decode()[:-2] for line in lines[19:13067]]
print("test.'")
print("test' the most frequently?")
index = 0
responseCount = 0
noArray=["the", "a", "I", "and", "on", "in", "or", "it", "for", "not", "that", "have",     "be", "he", "she", "they"]
response=input("What word will you search for?")
if response in noArray:
    for line in finalLines:
        index+=1
        if " "+response+" " in line:
            responseCount+=1
    print("test.")


else:

    for line in finalLines:
        index+=1
        if " "+response+" " in line:
            print(response+" found in line "+str(index)+":")
            print(line)
            responseCount+=1
    if responseCount = 0:
        print("test'")

    print(response+" was found "+str(responseCount)+" times.")
</code></pre>
