most of problem 4
argh i dont get bits in python