title: None type has no attribute index
body: <pre><code>nums= [1,2,2,3]
  
  def removnt(nums):
      for n in nums:
          i = nums.index(n)
          if nums[i]==nums[i+1]:
              nums = nums.remove(n)
  
  removnt(nums)
  </code></pre>
  
  <h1>Assume proper indent at all places.</h1>
  
  <p>The error that I get is</p>
  
  <pre><code>Traceback (most recent call last):
    File "source_file.py", line 20, in &lt;module&gt;
      removnt(nums)
    File "source_file.py", line 9, in removnt
      i = nums.index(n)
  AttributeError: 'NoneType' object has no attribute 'index'
  </code></pre>
  
  <p>How can I fix this attribute error?</p>