Gabriel A.
Gabriel A.

Reputation: 129

Printing each item in a multidimensional list on a new line doesn't work

Here is a snippet of my code:

maximum = list([[x[0], x[-1]] for x in score_list])
  print ("Here are the student's higest scores:")

for i in maximum:
  print(maximum)

Maximum contains:

[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]

I am adding some values from the front and end of maximum and converting them to a list. I am trying to print them out all on a new line with the for loop but it seems to just print

[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]
[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]
[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]
[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]
[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]
[['Andy', 8], ['Bill', 7], ['Steve', 7], ['Andrew', 10], ['Ted', 9], ['Lisa', 10]]

instead of each value once like:

['Andy',8]
['Steve',7]
['Bill',7]
(and so on)

I've googled for a solution to this but everywhere I go I see the for loop that I have above yet it does not work.

Upvotes: 0

Views: 33

Answers (1)

Jay T.
Jay T.

Reputation: 307

for i in maximum:
    print (i)

Upvotes: 1

Related Questions