"* To use `sys.argv` in our script, open a text editor and edit the script by adding an import statement, capturing the `sys.argv` value, and editing our last `print` line.\n",
"Both approaches are correct and have their own plus and minuses in general. However in this case, I would argue that EAFP is better since it makes the code more readable."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Improving the script: handling corner cases\n",
"\n",
"* Now try running your script without any arguments at all. What happens?\n",
"* Armed with what you now know, how would you handle this situation?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Working with modules\n",
"\n",
"* Sometimes it is useful to group functions and other objects in different files.\n",
"* Sometimes you need to use that fancy function you've written 2 years ago.\n",
"* This is where modules in Python come in handy.\n",
"* More officially, module allows you to share code in the form of libraries.\n",
"* You've seen one example: the `sys` module in the standard library\n",
"* There are many other modules in the standard library, as we'll see soon.\n",