also, i would recommend you to visit projecteuler.net you can solve math tasks and then see how others have done the same. you can fetch very good and pythonic solution there.