2D Lists

I am currently learning to utilize 2-Dimensional lists in Python

  • Two nested [FOR] loops can allow me to access EVERY list item.
    • [given “A” for the list]
      A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

      for row in A:
      for col in row:
      print(col)
      #will print each item in the list individually

      [OUTPUT]
      1
      2
      3
      4
      5
      6
      7
      8
      9
  • I learned that I can not only print out each item, but add them up and get an average between the values (IF THEY ARE INTEGERS)
  • I also am learning to make graphics with these lists

I will keep up and try to post about anything else that I learn in the meantime.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *