title: Why new error appears at the next coding line when putting a comma at the end of a certain line?
body: <p>I'm quite new with coding. I need your help.
  I did an exercise and hit the error. The code is like this:</p>
  <pre><code>def isAnagram(s,t):  
      if len(s)!=len(t):        
          return False
      else:    
          list_t = sorted(list(set(t))
          list_s = sorted(list(set(s))
          if list_s != list_t:            
              return False
          else:
              i=0
              j=[]
              k=[]
              for i in range len(list_s):
                  j.append(list_s.count(list_s[i]))
                  k.append(list_t.count(list_t[i]))
                  i=i+1
                  if j!=k:
                      return False
                  else:                      
                        return True
  </code></pre>
  <p>And I get this error</p>
  <pre><code> File &quot;&lt;ipython-input-43-5ac86c9b9c40&gt;&quot;, line 7
      list_s = sorted(list(set(s))
      ^
  SyntaxError: invalid syntax
  </code></pre>
  <p>If I put a comma at the end of 5th line, then I receive a new error:</p>
  <pre><code> File &quot;&lt;ipython-input-44-6a66b63cb96e&gt;&quot;, line 8
      if list_s != list_t:
                         ^
  SyntaxError: invalid syntax
  </code></pre>
  <p>Help me to understand why I made those two errors.</p>