How to take only the values of the array and not the entire array?
x = [1, 2, 3] y = x y.append(4) print(x) This code will return [1, 2, 3, 4] but I want only [1, 2, 3]. This works like I want it to: x = [1, 2, 3] y = [] y[0] = x[0] y[1] = x[1] y[2] = x[2] # Or use a for loop […]
issue while updating python array
new = [{‘n’: ‘1234’, ‘indicator’: ‘RSI’}, {‘n’: ‘1234’, ‘indicator’: ‘RSI’}, {‘n’: ‘1234’, ‘indicator’: ‘RSI’}, {‘n’: ‘1234’, ‘indicator’: ‘RSI’}] I am trying to update the above array 0 element only using new[0][‘indicator’]=’HMA’ but after updating when trying to print then below response appears. [{‘n’: ‘1234’, ‘indicator’: ‘HMA’}, {‘n’: ‘1234’, ‘indicator’: ‘HMA’}, {‘n’: ‘1234’, ‘indicator’: ‘HMA’}, {‘n’: […]