working python code