GoConqr has a new look! Let us know what you think.

Mind map

Lists, Tuples, Sets and Dictionaries

Benjamin Brandt English

Map content

Lists, Tuples, Sets and Dictionaries

  1. myList = ["lemon", "banana", True, "lemon", 4, 15]

    • ordered
      • changeable
        • allow duplicates
    • to append element to end of existing list:
      • myList.append("apple")
      • to remove element from list:
        • myList.remove("lemon")
          • only removes FIRST instance of "lemon"
        • myList.pop(3)
          • removes element at index 3
    • to access specific element in list:
      • item = myList[4]
  2. myTuple = ("mouse", 33, True, 1888, "guru")

    • ordered
      • unchangeable
        • allow duplicattes
    • anotherTuple = ("Captain Jack Sparrow",)
    • item = myTuple[1]
    • lastItem = myTuple[-1]
    • subtuples
      • print(myTuple[1, 3])
  3. mySet = {"lemon", "banana", True, 4, 15}

    • unordered
      • unchangeable
        • reject duplicates
    • to check if element exists in set:
      • print("apple" in mySet)
        • FALSE
      • print("banana" in mySet)
        • TRUE
      • to add element to set:
        • mySet.add("orange")
    • newSet = {"face", "elbow", 32}
      • mySet.update(newSet)
        • print(mySet)
  4. houseForRent = {"style": "American Craftsman", "bedrooms": 3, "bathrooms": 2, "rent": 2500, "available": True}

    • key : value
      • to add new key:value
        • houseForRent["color": "white"

Information

Description
Mind Map on Lists, Tuples, Sets and Dictionaries, created by Benjamin Brandt on 03/02/2021.
Created by
Benjamin Brandt
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?