What’s the Difference between a List and a ___? | Python Programming

Justin Alvey
3 min readJul 3, 2020

Lists are the backbone of Python programming language and you should know about them.

Photo by Sean Pierce on Unsplash

Python Data Types

The data types common to Python are as follows:

  1. lists
  2. dictionaries
  3. tuples
  4. sets
  5. numbers
  6. strings
  7. booleans
  8. and others!

What is the difference between a List and a dictionary?

A dictionary is Python is an un-ordered collection of elements that are accessed by keys. No duplicates are allowed in dictionaries.

A dictionary is made up of key-valued pairs. To access a dictionary’s elements you do so like this:

example_dictionary = {"employee_name":"Justin","employee_id":272}example_dictionary["age"] = 25 // Assign employee's age

Accessing values in a list is different. A list is an ordered collection that is changeable. Duplicate members are allowed. An example list is show below.

example_list = ["Jake","Debbie"]
example_list.append("Ralph")
print(example_list)
print(example_list[0])…

--

--

Justin Alvey

I’m passionate about #entrepreneurship, #programming, #space, #technology, and #writing.