title: What's happening here? It gives right output in jupyter notebook
body: <p><a href="https://i.stack.imgur.com/HeP1p.jpg" rel="nofollow noreferrer">enter image description here</a></p>
  <p><a href="https://i.stack.imgur.com/HeP1p.jpg" rel="nofollow noreferrer">enter image description here</a></p>
  <p>def rotate(nums, k):
  &quot;&quot;&quot;
  Do not return anything, modify nums in-place instead.
  &quot;&quot;&quot;
  max_1 = len(nums) - 1
  length = len(nums)
  res = [0] * length</p>
  <pre><code>    for i in range(len(nums)):
          if i + k &lt;= max_1:
              res[i + k] = nums[i]
          else:
              res[(i + k) - length] = nums[i]
              
      return res
  </code></pre>