{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Welcome to IPython notebook!\n", "--------------------------\n", "\n", "Time to get on with it and print the ceremonial `\"Hello world!`.\n", "\n", "To execute a cell, click on it, and then use SHIFT+ENTER (this will execute the contents of the cell, and move down to the next one!)\n", "\n", "There are other useful keyboard commands (see the Help menu) and the menu bar can always be used instead as well" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"Hello world!\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, for advanced users only:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys, time\n", "message = \"HELLO WORLD!\"\n", "\n", "L = len(message)\n", "for i in range(100):\n", " time.sleep(0.1)\n", " j = i % L\n", " if j > 0:\n", " sys.stdout.write(\"\\r\" + message[-j:] + \" \" + message[:L-j])\n", " else:\n", " sys.stdout.write(\"\\r\" + message)\n", " sys.stdout.flush()" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [Root]", "language": "python", "name": "Python [Root]" }, "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.1" } }, "nbformat": 4, "nbformat_minor": 1 }