The program below declares a list named dogNames with five elements: "Chewy","BarkBark","Goblin","Scout", and "Biter". It will then ask the user for a name to add at the beginning, a name to add in the middle, and a name to add at the end. Complete the code so the list is modified as expected. The final statement will print the resulting list to the screen.

First, add the first value to the beginning of the list.
Next, add the middle value just before index 3.
Finally, add the end value to the end of the list.
The following examples demonstrate the expected program output.

Enter a name to add at the beginning: Shaggy
Enter a name to add in the middle: Slowpoke
Enter a name to add at the end: Stretch
['Shaggy', 'Chewy', 'BarkBark', 'Slowpoke', 'Goblin', 'Scout', 'Biter', 'Stretch']
Enter a name to add at the beginning: First
Enter a name to add in the middle: Middle
Enter a name to add at the end: Last
['First', 'Chewy', 'BarkBark', 'Middle', 'Goblin', 'Scout', 'Biter', 'Last']

dogNames = ["Chewy","BarkBark","Goblin","Scout","Biter"]

first = input("Enter a name to add at the beginning: ")
middle = input("Enter a name to add in the middle: ")
end = input("Enter a name to add at the end: ")

#student code here

print(dogNames)

#student code here

dogNames.insert(0, first)
dogNames.insert(3, middle)
dogNames.append(end)

print(dogNames)

Traceback (most recent call last):

File "Dogs.py", line 2, in <module>
dogNames.insert(0, first)
NameError: name 'dogNames' is not defined

The error message suggests that the variable `dogNames` is not defined. This error most likely occurs because the code provided before the student code is missing. The correct code should include the declaration of the `dogNames` list. Here is the updated code:

```python
dogNames = ["Chewy", "BarkBark", "Goblin", "Scout", "Biter"]

first = input("Enter a name to add at the beginning: ")
middle = input("Enter a name to add in the middle: ")
end = input("Enter a name to add at the end: ")

dogNames.insert(0, first)
dogNames.insert(3, middle)
dogNames.append(end)

print(dogNames)
```

Make sure to include the declaration of `dogNames = ["Chewy","BarkBark","Goblin","Scout", "Biter"]` before the student code.