Solving project euler tasks on python