Home > Net >  Using a list to get data(list in a list) (Python 3.7)
Using a list to get data(list in a list) (Python 3.7)

Time:02-12

Is there a way to get list data within a list? a person name containing data(e.g. Grades) while the person is in a list.

list_name['Dan']['Physics']

returns 98

CodePudding user response:

Look there are much ways to do that.

1- By for loop:

# using for loop
a = [1, 2, 3, 4, 5]
  
# printing the list using loop
for x in range(len(a)):
    print a[x],

-> output 1 2 3 4 5

If you want to print 2D array ,I recommend you this answer

  • Related