<jupyter_start><jupyter_text>All the IPython Notebooks in this **Python Examples** series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/90_Python_Examples)**  Python Program to Concatenate Two ListsIn this example, you will learn to concatenate two lists in Python.To understand this example, you should have the knowledge of the following **[Python programming](https://github.com/milaan9/01_Python_Introduction/blob/main/000_Intro_to_Python.ipynb)** topics:* **[Python List](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List.ipynb)*** **[Python List extend()](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List_Methods/003_Python_List_extend%28%29.ipynb)**<jupyter_code># Example 1: Using + operator

list_1 = [7, 'n', 'm']
list_2 = [3, 6, 9]

list_joined = list_1 + list_2
print(list_joined)

'''
>>Output/Runtime Test Cases:
     
[7, 'n', 'm', 3, 6, 9]
'''<jupyter_output>[7, 'n', 'm', 3, 6, 9]<jupyter_text>**Explanation:** In this example, **`+`** operator is used to concatenate two lists.<jupyter_code># Example 2: Using iterable unpacking operator *

list_1 = [7, 'n', 'm']
list_2 = range(3, 6)

list_joined = [*list_1, *list_2]
print(list_joined)
    
'''
>>Output/Runtime Test Cases:
     
[7, 'n', 'm', 3, 4, 5]
'''<jupyter_output>[7, 'n', 'm', 3, 4, 5]<jupyter_text>**Explanation:** **`*`** operator allows unpacking inside the list or tuple.<jupyter_code># Example 3: With unique values

list_1 = [7, 'n', 'm']
list_2 = [7, 9, 12]

list_joined = list(set(list_1 + list_2))
print(list_joined)
    
'''
>>Output/Runtime Test Cases:
     
[7, 'n', 9, 12, 'm']
'''<jupyter_output>[7, 'm', 9, 'n', 12]<jupyter_text>**Explanation:** If you want the unique items from a concatenated list, you can use **`list()`** and **`set()`**. **`set()`** selects the unique values and **`list()`** converts the set into list.<jupyter_code># Example 4: Using extend()

list_1 = [7, 'n', 'm']
list_2 = [7, 9, 12]

list_2.extend(list_1)
print(list_2)
    
'''
>>Output/Runtime Test Cases:
     
[7, 'n', 9, 12, 'm']
'''<jupyter_output>[7, 9, 12, 7, 'n', 'm']
{'fraction_non_alphanumeric': 0.18744098205854579, 'fraction_numerical': 0.046742209631728045, 'mean_word_length': 5.363363363363363, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 22, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '619300', 'license': 'MIT', 'n_tokens_mistral': 907, 'n_tokens_neox': 814, 'n_words': 218, 'path': '02_Python_Datatypes_examples/015_concatenate_two_lists.ipynb', 'repo_name': 'peterennis/90_Python_Examples', 'size': '2125'}