Every line of 'how to take 2d array input in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
83 def shape2d(a): 84 """ 85 a: a int or tuple/list of length 2 86 """ 87 if type(a) == int: 88 return [a, a] 89 if isinstance(a, (list, tuple)): 90 assert len(a) == 2 91 return list(a) 92 raise RuntimeError("Illegal shape: {}".format(a))