cange the for i in range quantity loop in one operation