Python code for CS algo solutions