# Reference guide: Python concepts from module 3; Terms and definitions from Course 7, Module 3

<span style="font-size: 16pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Built-in functions</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following built-in functions are commonly used in Python.</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">str()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Converts the input object to a string</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">str(10)</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Converts the integer </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">10</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"10"</span>


### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">len()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns the number of elements in an object</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(len("security"))</span>

## <span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns and displays </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">8</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, the number of characters in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"security"</span>

## <span style="font-size: 16pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">String methods</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following methods can be applied to strings in Python. </span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.upper()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a copy of the string in all uppercase letters</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print("Security".upper())</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns and displays a copy of the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Security"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> as </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"SECURITY"</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.lower()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a copy of the string in all lowercase letters</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print("Security".lower())</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns and displays a copy of the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Security"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> as </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"security"</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.index()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Finds the first occurrence of the input in a string and returns its location</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print("Security".index("c"))</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Finds the first occurrence of the character </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"c"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"Security"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and returns and displays its index of </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span>


## <span style="font-size: 16pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">List methods</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following methods can be applied to lists in Python. </span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.insert()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adds an element in a specific position inside the list</span>

<span style="font-size: 13pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list = \["elarson", "fgarcia", "tshah"\]</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list.insert(2,"wjaffrey")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adds the element </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"wjaffrey"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> at index </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to the </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; the list becomes </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["elarson", "fgarcia", "wjaffrey", "tshah"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.remove()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Removes the first occurrence of a specific element inside a list</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list = \["elarson", "bmoreno", "wjaffrey", "tshah"\]</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list.remove("elarson")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Removes the element </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"elarson"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> from the </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; the list becomes </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["fgarcia", "wjaffrey", "tshah"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.append()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adds input to the end of a list</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list = \["bmoreno", "wjaffrey", "tshah"\]</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list.append("btang")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adds the element </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"btang"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to the end of the </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; the list becomes </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["fgarcia", "wjaffrey", "tshah", "btang"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.index()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Finds the first occurrence of an element in a list and returns its index</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list = \["bmoreno", "wjaffrey", "tshah", "btang"\]</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(username\_list.index("tshah"))</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Finds the first occurrence of the element </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"tshah"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and returns and displays its index of </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span>


## <span style="font-size: 16pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Additional syntax for working with strings and lists</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following syntax is useful when working with strings and lists. </span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+ </span><span style="font-size: 14pt; font-family: 'Google Sans', sans-serif; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(concatenation)</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Combines two strings or lists together</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">device\_id = "IT"+"nwp12"</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Combines the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"IT"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> with the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"nwp12"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and assigns the combined string of </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"ITnwp12"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to the variable </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">device\_id</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">users = \["elarson", "bmoreno"\] + \["tshah", "btang"\]</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Combines the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["elarson", "bmoreno"\]</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> with the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["tshah", "btang"\]</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and assigns the combined list of </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["elarson", "bmoreno", "tshah", "btang"\]</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to the variable </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">users</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\[\] </span><span style="font-size: 14pt; font-family: 'Google Sans', sans-serif; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(bracket notation)</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Uses indices to extract parts of a string or list </span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print("h32rb17"\[0\])</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Extracts the character at index </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, which is (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"h"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">), from the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"h32rb17"</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print("h32rb17"\[0:3\])</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Extracts the slice </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\[0:3\]</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, which is (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"h32"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">), from the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"h32rb17"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; the first index in the slice (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">0</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) is included in the slice but the second index in the slice (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) is excluded</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list = \["elarson", "fgarcia", "tshah"\]</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(username\_list\[2\])</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Extracts the element at index </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, which is (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"tshah"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">), from the </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">username\_list</span>


## <span style="font-size: 16pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Regular expressions</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The following </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> module function and regular expression symbols are useful when searching for patterns in strings. </span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall()</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to a regular expression</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("a53", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a53"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\\w</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Matches with any alphanumeric character; also matches with the underscore (</span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\_</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\w", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\w"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to any alphanumeric character and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a", "5", "3", "3", "2", "c", "E"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Matches to all characters, including symbols</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall(".", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"."</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to all characters and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a", "5", "3", "-", "3", "2", "c", " ", ".", "E"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\\d</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Matches to all single digits</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\d", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\d"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to all single digits and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["5", "3", "3", "2"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\\s</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Matches to all single spaces</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\d", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\s"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to all single spaces and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\[" "\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\\.</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Matches to the period character</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\.", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\."</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to all instances of the period character and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["."\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Represents one or more occurrences of a specific character</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\w+", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\w+"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to one or more occurrences of any alphanumeric character and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a53", "32c", "E"\]</span>


### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\*</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Represents, zero, one or more occurrences of a specific character</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\w\*", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\w\*"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to one or more occurrences of any alphanumeric character and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a53", " ", "32c", " ", " ", "E"\]</span>

### <span style="font-size: 14pt; font-family: 'Courier New', monospace; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">{ }</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Represents a specified number of occurrences of a specific character; the number is specified within the curly brackets</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import re</span>

<span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re.findall("\\w{3}", "a53-32c .E")</span>

<span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Returns a list of matches to the regular expression pattern </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"\\w{3}"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in the string </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"a53-32c .E"</span><span style="font-size: 12pt; font-family: 'Google Sans', sans-serif; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; matches to exactly three occurrences of any alphanumeric character and returns the list </span><span style="font-size: 12pt; font-family: 'Courier New', monospace; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">\["a53","32c"\]</span>

---

# Glossary terms from module 3

**Algorithm:** A set of rules that solve a problem

**Bracket notation:** The indices placed in square brackets

**Debugging:** The practice of identifying and fixing errors in code

**Immutable:** An object that cannot be changed after it is created and assigned a value

**Index:** A number assigned to every element in a sequence that indicates its position

**List concatenation:** The concept of combining two lists into one by placing the elements of the second list directly after the elements of the first list

**List data:** Data structure that consists of a collection of data in sequential form

**Method:** A function that belongs to a specific data type

**Regular expression (regex):** A sequence of characters that forms a pattern

**String concatenation:** The process of joining two strings together

**String data:** Data consisting of an ordered sequence of characters

**Substring:** A continuous sequence of characters within a string