Cynthia
Cynthia

Reputation: 397

How to create an array of lists in python?

Does anyone know how to create an array of lists in python?

For example, if I want the final structure to contain data where the 1st dimension is fixed but the 2nd dimension varies:

index 0: [5, 4, 3, 2, 1]

index 1: [6, 5, 4, 3, 2, 1]

index 2: [4, 3, 2, 1]

Upvotes: 2

Views: 11359

Answers (1)

SuperStew
SuperStew

Reputation: 3054

It's just called a list of lists

x=[[5, 4, 3, 2, 1],[6, 5, 4, 3, 2, 1],[4, 3, 2, 1]]

Upvotes: 3

Related Questions