GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Lists, Tuples, Sets and Dictionaries

Benjamin Brandt Englisch

Inhalt der Mindmap

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"

Informationen

Beschreibung
Mindmap am Lists, Tuples, Sets and Dictionaries, erstellt von Benjamin Brandt am 03/02/2021.
Erstellt von
Benjamin Brandt
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck