Question: ```
data = [
    "Andromeda - Shrub",
    "Bellflower - Flower",
    "China Pink - Flower",
    "Daffodil - Flower",
    "Evening Primrose - Flower",
    "French Marigold - Flower",
    "Hydrangea - Shrub",
    "Iris - Flower",
    "Japanese Camellia - Shrub",
    "Lavender - Shrub",
    "Lilac - Shrub",
    "Magnolia - Shrub",
    "Peony - Shrub",
    "Queen Anne's Lace - Flower",
    "Red Hot Poker - Flower",
    "Snapdragon - Flower",
    "Sunflower - Flower",
    "Tiger Lily - Flower",
    "Witch Hazel - Shrub",
]

flowers = []
shrubs = []

for plant in data:
    if "- Flower" in plant:
        flowers.append(plant)
    else:
        shrubs.append(plant)
print(flowers)
print(shrubs)

```

Answer: 
Split it on  `-` and then take the first split

```
for plant in data:
    plant_name, category = plant.split(' -', 1)
    if "Flower" in category:
        flowers.append(plant_name)
    else:
        shrubs.append(plant_name)

```
```
flowers = [x.split(' - ')[0] for x in data if x.split(' - ')[1] == 'Flower']
shrubs = [x.split(' - ')[0] for x in data if x.split(' - ')[1] == 'Shrub']
print(flowers)
print('--------')
print(shrubs)

```

Result:

```
['Bellflower', 'China Pink', 'Daffodil', 'Evening Primrose', 'French Marigold', 'Iris', "Queen Anne's Lace", 'Red Hot Poker', 'Snapdragon', 'Sunflower', 'Tiger Lily']
```

---

```
['Andromeda', 'Hydrangea', 'Japanese Camellia', 'Lavender', 'Lilac', 'Magnolia', 'Peony', 'Witch Hazel']
```