Updated Python code snippets