From 034d3fe808720bb571eb72ad51c2e5d080e17505 Mon Sep 17 00:00:00 2001 From: cif2cif Date: Tue, 23 Feb 2016 17:10:18 +0100 Subject: [PATCH] Added Example in Classes --- python/1_8_Classes.ipynb | 45 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/python/1_8_Classes.ipynb b/python/1_8_Classes.ipynb index 7f2b53f..07c0377 100644 --- a/python/1_8_Classes.ipynb +++ b/python/1_8_Classes.ipynb @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": false }, @@ -67,11 +67,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "<__main__.TV_Set object at 0x7fec69171860> off\n" + ] + }, + { + "data": { + "text/plain": [ + "__main__.TV_Set" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#Example object instantiation\n", "\n", @@ -80,6 +98,27 @@ "type(my_tv)" ] }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Samsung on\n" + ] + } + ], + "source": [ + "# Call on method\n", + "my_tv.on()\n", + "print(my_tv.name, my_tv.status)" + ] + }, { "cell_type": "markdown", "metadata": {},