How can rotate multi-dimensional List without using the zip function, I have this list (but it can be longer):   testlist = [[1, 2, 3],            [4, 5, 6],            [7, 8, 9],            [10,11,12]]   I want to rotate it 90 degrees clockwise and also 90 degrees counterclockwise. ps: The reason i don't want to use zip is because this is a homework and i must write it in vanilla python .
Inspired by , say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff.  [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6]   Becomes:  [3][9][5][1] [4][0][6][2] [5][1][7][3] [6][2][8][4]   Update: Nick's answer is the most straightforward, but is there a way to do it better than n^2? What if the matrix was 10000x10000?
How can we close questions with bounties? I just encountered , which is very cute and funny and has nothing to do with programming.  I tried voting to close, but was informed by the system that I can't do that when there's a bounty on the question.  So, since there's a seven-day bounty, this will remain open for at least a week.  I really don't care what happens to the bounty rep, I just want to be able to close questions that are thoroughly inappropriate although not offensive. Hide processes from other users based on groups (under Linux)? Is it possible to configure process hiding for certain user groups under a linux system?  For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc.  Is it possible to configure such a setup with SELinux?  (I vaguely remember a similar feature in the funny grsecurity patch set - but IIRC, it was more generic - and besides, I want to configure a stock linux distro without having to maintain a custom kernel.)  Edit: For better illustration, . The example is not that generic, but one can configure that a user or some users can only see information of their own processes in ps etc. How to reconnect a logically disconnected USB device? I vaguely remember a SciFi novel from my younger days, where scientists discover "alternative" forms of power beside electromagnetism.  I do not remember the specific forms, but it was something along the lines of "electrogravity", "magnetogravity" etc. -- you get the idea. If I remember correctly, the effects of these power forms were basically psionic / magic in nature.  Unfortunately I remember very little of the actual plot, and couldn't put it into words with any coherency. Some treachery from within the group of scientists, perhaps some involvement of aliens? I cannot really remember. I just remember I enjoyed the story very much, and would like to re-read it.  The title could be "The fifth column" or similar -- then again I might be confusing two seperate novels.  I know that's not much, sorry. Anyone remembers this? How to get client's IP address using JavaScript? I checked this  but didn't fully understand it.   I know that the volume of a right circular cone is $V = \frac{1}{3}\pi x^2h$  I know that I must take the first derivative and set it equal to zero, which will find the maximum.   My problem is how to deal with the variable $h$, the height?   How can I rewrite that in terms of $x$ or $r$.      I have tried to implicitly differentiate this equation, but that wasn't helpful for me. Is there any way to ensure that a specific USB key always gets the same drive letter? What's interesting in latus rectum? I'm a maths teacher in Italian secondary school and I've been spending some time trying to construct "meaningful" problems about conic sections. I particularly like problems which focus on practical applications of the curves (in engineering, physics, finance, etc.), on their geometric properties, or both.  I know there's this really easy formula to find the latus rectum of a conic from its key parameters. It's quite nice and straightforward to derive it, but...  ... What's its use? Why should anyone be interested in knowing the latus rectum of a curve? Is there any physical phenomenon, any architectural trick, or anything else where its position and/or length plays a key role?   I know just the relation between angular momentum, standard gravitational parameter and latus rectum in an astronomical orbit ($l=\frac{h^2}{GM}$, where $l$ is half the latus rectum, and $h$ is the ratio between the angular momentum associated to the orbiting body and its mass). It's cool, but a bit tricky, and probably too far-fetched for secondary school students... Is there anything simpler? Or just anything else, at any difficulty level?  Many thanks! What is the best collation to use for MySQL with PHP? I'm wondering if there is a "best" choice for collation in MySQL for a general website where you aren't 100% sure of what will be entered? I understand that all the encodings should be the same, such as MySQL, Apache, the HTML and anything inside PHP.  In the past I have set PHP to output in "UTF-8", but which collation does this match in MySQL? I'm thinking it's one of the UTF-8 ones, but I have used utf8_unicode_ci, utf8_general_ci, and utf8_bin before. Problem with \mkbibdateapalongextra of biblatex-apa Why can't XeTeX handle this dank meme? an "X is an X is an X" what does this mean? Typeset two styles of the same text over top each other Notation for functions vs. numbers Why Does the Transaction Log Keep Growing or Run Out of Space? How can I change my default text editor from gedit to Emacs? LED as power generator $\mathbb Q[x]/(x^2+1)$ is not isomorphic to $\mathbb Q[x]/(x^2+2)$ $T$ self-adjoint on Hilbert space $H$, $T^n=T^{n+1}$ will $T$ be an orthogonal projection operator? I have seen several answers and proofs here at MSE that a self-adjoint operator $T$ on a Hilbert space $H$ where $T^2=T$, implies $T$ being an orthogonal projection operator.   The thought struck me; what would happen if the condition $T^2=T$ is replaced by $T^3=T^2$ or instead by $T^4=T^3$ or why not more generally by $T^n=T^{n+1}$ for some $n\in\mathbb{N}$? Would this still imply $T$ to be an orthogonal projection operator?  I guess someone must have thought of this before me? In that case perhaps there is a reference in the literature for this or perhaps the proof is way simpler than I might expect? $(p\!-\!1\!-\!h)!\,h! \equiv (-1)^{h+1}\!\!\pmod{\! p}\,$ [Wilson Reflection Formula]