Skip to content

Instantly share code, notes, and snippets.

@arosh
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arosh/3e12627c153793a8325a to your computer and use it in GitHub Desktop.
Save arosh/3e12627c153793a8325a to your computer and use it in GitHub Desktop.
Multi Dimensional Array in Python
# coding: utf_8
from __future__ import division, print_function, unicode_literals
from future_builtins import *
def dim(*d):
if len(d) == 1:
return [0]*d[0]
return [dim(*d[1:]) for _ in xrange(d[0])]
def main():
print(repr(dim(2, 3, 4)))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment