[Solved] Subtract values at each index from list in python [closed]
I hope I’ve understood your question right. If you want to subtract each value from x[<indexes_for_x>] then you can do: x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] indexes_for_x = [0, 1, 2, 3] for v in indexes_for_x: print(f”y_at_index_{v} = {[w – x[v] for w in x]}”) Prints: y_at_index_0 = [0, … Read more