Time Complexity In Python Code