Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to define a two-dimensional array in Python

Asked by Rutuja Mishra Apr 10, 2021 1.4K views 1 answer
Share

About this question

I want to define a two-dimensional array without an initialized length like this:

Matrix = [][]

but it does not work...

I've tried the code below, but not working:

Matrix = [5][5]

Error:

Traceback ... 

IndexError: list index out of range

How python define 2d array ? What’s wrong please suggest.

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.