complexity with python