'remove commas , and [ ] from a list python 3

I have a this funtion

n=5
nums=5 1 4 2 3

def LIS(nums, n):
    dp = [] 
    dp_list = [] 

    for i in range(n):
        dp.append(1)
        dp_list.append([nums[i]])
        for j in range(i):
            if nums[j] < nums[i]:
                dp[i] = max(dp[i], dp[j] + 1)
                if len(dp_list[i]) <= len(dp_list[j]):
                    dp_list[i] = dp_list[j] + [nums[i]]
   
    print(dp_list[dp.index(max(dp))])
    return dp_list

And I get this result:

[1, 2, 3]

But I wan something like this as result

1 2 3

I have tried using this, but the result still been the same

values = ''.join([str(i) for i in LIS(nums,n)])


Solution 1:[1]

print(*dp_list[dp.index(max(dp))])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zeeshan12396