Python: Sequences

Beschreibung

Sequences in Python
Chantal du Plessis
Mindmap von Chantal du Plessis, aktualisiert more than 1 year ago
Chantal du Plessis
Erstellt von Chantal du Plessis vor etwa 6 Jahre
29
0

Zusammenfassung der Ressource

Python: Sequences
  1. STRINGS
    1. HOW STRINGS ARE STORED
      1. Each of the string characters are stored in a specific index location : see example below
      2. GENERAL
        1. Strings are immutable (they can not be modified)
          1. A string is a sequence of characters used to store text information
            1. A string can be enclosed in single, double or triple quotes (',",''')
              1. To embed a new line in a string use \n : k="Hello World!\nIt's hot"
                1. To continue a line that spans over multiple rows use \ : k="Hello World!\ It's hot"
                  1. Triple quoted strings do not use escape sequences (backslash) - line breaks are preserved as newline characters
                  2. FUNCTIONS AND METHODS
                    1. String Function: A function is a module of code that is called by name. You can pass data to the function in the form of arguments, and it can return some value. The data to be passed needs to be explicit.
                      1. String Method: A method is also called by name and may return a value. Methods are associated with objects.
                    2. LISTS
                      1. A list is a collection of elements, which might include other lists. Lists begin and end with square brackets and the elements are separated with commas. ["Apple","Pear","Orange"]
                        1. FINDING THE LENGTH OF A LIST
                          1. To find the length of a list you use the len( ) function, which returns the length as an index location for the last element plus one.
                          2. LIST SLICING
                          3. Indexing starts at 0. Last element starts with -1
                          4. TUPLES
                            1. Tuples are immutable (they can not be modified)
                            2. SETS
                              1. WHAT IS A SEQUENCE?
                                1. A sequence contains objects that are kept in a specific order.
                                  1. You can identify an object in a sequence by its index location.
                                    1. You can also extract from a sequence with the slicing operation.
                                      1. Three operations commonly applied to sequences + concatenate, * repeat, [ ] fetches a particular element.
                                      Zusammenfassung anzeigen Zusammenfassung ausblenden

                                      ähnlicher Inhalt

                                      Python Quiz
                                      karljmurphy
                                      Think Python
                                      tsilvo2001
                                      Basic Python - Print Formatting
                                      Rebecca Noel
                                      What is Python?
                                      Daniel Ingram
                                      Python
                                      54671
                                      Know your Python!
                                      educ8ict
                                      Basic Python - Strings
                                      Rebecca Noel
                                      Study on IoT systems design
                                      Tomasz Cieplak
                                      Python
                                      Kirstie Wu
                                      OpenSource Programming
                                      Faheem Ahmed
                                      Basic Python - Lists
                                      Rebecca Noel