¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Linear Data Structures

Alyssa M. Inglés

Contenido del mapa

Linear Data Structures

  1. Lists

    • Ordered: elements of a list can be accessed using their indexes
    • Changeable: elements can be added to or deleted from the list
    • Allow duplicates: multiple elements can be the same
    • Elements in the list can be of different data types
    • petExample = [ "dog", "golden retriever", 3, True]
      • To add an element: petExample.append("Penny")
        • petExample = ["dog", "golden retriever", 3, True, "Penny"]
          • To delete an element: petExample.remove(3)
            • petExample = ["dog", "golden retriever", True, "Penny"]
              • To access an element: petType = petExample[0]
                • petType = "dog"
  2. Tuples

    • Ordered: elements of a tuple can be accessed using their indexes
    • Unchangeable: elements cannot be added to or deleted from the tuple
    • Allow duplicates: multiple elements can be the same
    • Elements in the tuple can be of different data types
    • petExample = ("dog", "golden retriever", 3, True)
      • petName = ("Penny",)
        • To access an element: petType = petExample[0]
          • petType = "dog"
            • To access multiple elements: print(petExample[1:3])
              • ('golden retriever', 3)
  3. Sets

    • Unordered: elements of a set cannot be accessed using their indexes
    • Unchangeable: elements cannot be changed, but elements can be added
    • Reject duplicates: multiple elements cannot be the same
    • Elements in the set can be of different data types
    • petExample = {"dog", "golden retriever", 3, True}
      • To add an element: petExample.add("Penny")
        • Two sets can be merged: petStats = {"Medium", 25}
          • petExample.update(petStats)
            • petExample = {"dog", "golden retriever", 3, True, "Penny", "Medium", 25}
  4. Dictionaries

    • Unordered: elements of a dictionary cannot be accessed using their indexes
    • Changeable: elements can be added to and changed in the dictionary
    • Reject duplicates: multiple keys cannot be the same
    • Elements in the dictionary can be of different data types
    • Stores data in the dictionary in key : value format
      • key : value "age" : 19
        • petExample = { "pet type" : "dog", "breed" : "golden retriever", "age" : 3, "fixed" : True}
          • To add a key : value: petExample["name"] = "Penny"
            • To change a value in one of the keys: petExample["age"] = 4
              • petExample = { "pet type" : "dog", "breed" : "golden retriever", "age" : 4, "fixed" : True, "name" : "Penny"}
                • To access a value in a key: theBreed = petExample["breed"]
                  • theBreed = "golden retriever"

Información

Descripción
Mapa Mental sobre Linear Data Structures, creado por Alyssa M. el 26/01/2021.
Creado por
Alyssa M.
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?