Fun with Python Lists

by Ace Devs
Fun with Python Lists

Fun with Python Lists

 

Lists are one of Python’s most flexible data types.

fruits = ['apple', 'banana', 'cherry']\nprint(fruits[1])

You can loop through a list like this:

for fruit in fruits:
  print(fruit)

Python lists can store any data type — even other lists! “Here’s a visual explainer: