Rotate

You don’t learn cool things everyday. And today is not everyday, learnt this neat trick to rotate a matrix with a one liner in #python!!!

Rotate_A_matrix_in_python

b = np.array(zip(*a[::-1]))

Simple and powerful. Waiting for a chance to use it somewhere in actual code…

Want to understand what’s happening visit this page by Peter Norvig, director of research Google!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s