title: why isn't my code working where I m wrong?
body: <p>Write a function rotate(m) that takes a list representation m of a square matrix as input, and returns the matrix obtained by rotating the original matrix clockwize by 90 degrees. For instance, if we rotate the matrix above, we get</p>
  <p>rotate([[1,2],[3,4]])
  [[3, 1], [4, 2]]
  Your function should not modify the argument m provided to the function rotate().</p>
  <pre><code>def rotate(m):
  k=[]
  k_U=[]
  for x in range(0,len(m[len(m)-1])):
      for i in range(len(m),0):
        
        k_U= k_U +[m[i-1][x]]
  
      k=k+k_U
      k_U.clear()
  
  return(k)
    
  </code></pre>
  <p>print(rotate([[2,3],[5,4]]))</p>