-5

I am trying to print the number of the row in 2d array (list of the list) like:

A B C D E F

1: - - - - - -

2: - - - - - -

I need to print only the number of rows 1:

can someone pls guide me

def printChart(list):
    print('\n  A  B  C  D  E  F')
    for i in list:
        for e in i:
            print(' ', e, end='')
        print()
    print()
Rasp
  • 11
  • 5

1 Answers1

-1

From my understanding, you want to add a number to the line.

def printChart(abc):
    print('\n  A  B  C  D  E  F')
    for x,i in enumerate(abc):
        print(x, ' ', i)

alpha = ["A", "B" , "C" ,"D", "E", "F"]
printChart(alpha)

OUTPUT:

0   A
1   B
2   C
3   D
4   E
5   F
Aly Abdelaziz
  • 292
  • 4
  • 24