How to use 'how to take 2d array input in python' in Python

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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
83def 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))
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets