Skip to content

Instantly share code, notes, and snippets.

@EuniceMadya
Created April 22, 2019 07:56
Show Gist options
  • Select an option

  • Save EuniceMadya/d7a7f9b82e3df9812f3e50616f041ad1 to your computer and use it in GitHub Desktop.

Select an option

Save EuniceMadya/d7a7f9b82e3df9812f3e50616f041ad1 to your computer and use it in GitHub Desktop.
Python array
ar = [[-1 for i in range (5)] for j in range (10)] # this means creating an array with 5 cols and 10 rows
ar[9][4] #this would result in -1, means the 10th row, 5th col, i.e. the right-bottom corner of the array
ar[4][9]
len(ar) #number of rows
len(ar[0]) #number of cols
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment