Last active
August 29, 2015 14:16
-
-
Save arosh/3e12627c153793a8325a to your computer and use it in GitHub Desktop.
Multi Dimensional Array in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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