The dynamics of a one dimensional quantum walker on the lattice with two internal degrees of freedom, the coin states, is considered. The discrete time unitary dynamics is determined by the repeated action of a coin operator in U (2) on the internal degrees of freedom followed by a one step shift to the right or left, conditioned on the state of the coin. For a fixed coin operator, the dynamics is known to be ballistic.We prove that when the coin operator depends on the position of the walker and is given by a certain i.i.d. random process, the phenomenon of Anderson localization takes place in its dynamical form. When the coin operator depends on the time variable only and is determined by an i.i.d. random process, the averaged motion is known to be diffusive and we compute the diffusion constants for all moments of the position.