{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating a Python program (not on the notebook) -- _Optional_\n", "\n", "\n", "* Use SSH and connect to your Unix shell\n", "* Type `nano helloworld.py` to open `nano`, a (relatively easy to use) text editor, and create the file `helloworld.py`\n", "* In the text editor, type:\n", " `print('Hello my dear friend!')`\n", "* Type Ctrl+X, to save the file and close the editor.\n", "* In the shell prompt, type `python helloworld.py` to see the outcome\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Exercise\n", "\n", "Open and change the file `helloworld.py` to print your own message.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# execute your steps in the shell" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating a self-executing Python program -- _Optional_\n", "\n", "* Repeat the steps as above, but with the following change: In the first line of your program, type: `#!/usr/bin/python`\n", "* Save the file with the name `hello`\n", "* In the shell, type `chmod 700 hello`. This makes our file _executable_.\n", "* Finally type `./hello` and see what happens." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# execute your steps in the shell" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 1 }