'Insert variable with iteration into list display as variable with interation

I want to automate a list that looks like this in python.

weights = [x[0],x[1],x[2]]

I have written code but it just gives the value of iteration. I want to display the variable. I tried writing it as a string (['x[0]']), however I could not convert it to a variable from a string.

assets = ['AAPL','MSFT',"GOOG"]

weights = []

for i in range(len(assets)):
    weights.append(x[i])
    
weights


Sources

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

Source: Stack Overflow

Solution Source