Time Complexity And Space Complexity In Python