By studying the algebraic structure of the parity check matrix of a linear code we show that the weight distribution is a function only of the quantities

, the number of

columns of the parity check matrix with rank

. We apply this to obtain a new formula for the weight distribution of the distance

-ary Hamming code and for the distance

-ary conic code. We give the definition of a conic code and some of its properties.