Update the given Python code to remove all the duplicated elements from a list.
def remove_duplicates(nums):
    new_list = []
    for num in nums:
        if num not in new_list:
            new_list.append(num)
    return new_list