Find and remove the unnecessary code in the following Python code snippet.
def get_data(url):
    data = [] # create an empty list
    response = requests.get(url)
    if response.status_code == 200:
        for item in response.json():
            data.append(item)# add to the list
def get_data(url):
    data = []
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()