In [1]:
#1. Concatenating Lists of Integers
patient_ids_1 = [101, 102, 103]
patient_ids_2 = [104, 105, 106]
all_patient_ids = patient_ids_1 + patient_ids_2
print(all_patient_ids)
[101, 102, 103, 104, 105, 106]
In [2]:
#2. Concatenating Lists of Strings
patient_names_1 = ["Alice", "Bob", "Charlie"]
patient_names_2 = ["David", "Eve", "Frank"]
all_patient_names = patient_names_1 + patient_names_2
print(all_patient_names)
[''''Alice'''', ''''Bob'''', ''''Charlie'''', ''''David'''', ''''Eve'''', ''''Frank'''']
In [3]:
import pprint
#3. Concatenating Lists of Dictionaries
patient_records_1 = [
{"id": 101, "name": "Alice", "age": 30},
{"id": 102, "name": "Bob", "age": 25}
]
patient_records_2 = [
{"id": 103, "name": "Charlie", "age": 35},
{"id": 104, "name": "David", "age": 40}
]
all_patient_records = patient_records_1 + patient_records_2
pprint.pp(all_patient_records)
[{''''id'''': 101, ''''name'''': ''''Alice'''', ''''age'''': 30}, {''''id'''': 102, ''''name'''': ''''Bob'''', ''''age'''': 25}, {''''id'''': 103, ''''name'''': ''''Charlie'''', ''''age'''': 35}, {''''id'''': 104, ''''name'''': ''''David'''', ''''age'''': 40}]
In [4]:
import pprint
#4. Concatenating Lists Using Healthcare Data
patient_data_1 = [
{"id": 101, "name": "Alice", "age": 30},
{"id": 102, "name": "Bob", "age": 25}
]
patient_data_2 = [
{"id": 103, "name": "Charlie", "age": 35},
{"id": 104, "name": "David", "age": 40}
]
all_patient_data = patient_data_1 + patient_data_2
pprint.pp(all_patient_data)
[{''''id'''': 101, ''''name'''': ''''Alice'''', ''''age'''': 30}, {''''id'''': 102, ''''name'''': ''''Bob'''', ''''age'''': 25}, {''''id'''': 103, ''''name'''': ''''Charlie'''', ''''age'''': 35}, {''''id'''': 104, ''''name'''': ''''David'''', ''''age'''': 40}]