Algorithms using python