Let x be the number of liters taken from container A.
The total amount of mixture from both containers is x + (100 - x) = 100.
The total amount of acid in the mixture is 0.4x + 0.6(100 - x) = 17.
Solving for x, we get x = 40 liters.
Therefore, the chemist took 40 liters from container A.