From accaef2177c7b22c78cef734e19dd05887ce689a Mon Sep 17 00:00:00 2001 From: rasbt Date: Wed, 19 Mar 2014 00:38:07 -0400 Subject: [PATCH] true false ipython notebook --- python_true_false.ipynb | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/python_true_false.ipynb b/python_true_false.ipynb index afd0800..7ef1577 100644 --- a/python_true_false.ipynb +++ b/python_true_false.ipynb @@ -97,7 +97,23 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "my_true_val == True: True\n", + "my_true_val is True: True\n", + "my_true_val == None: False\n", + "my_true_val is None: False\n", + "my_true_val == False: False\n", + "my_true_val is False: False\n", + "\"if my_true_val:\" is True\n", + "\"if not my_true_val:\" is False\n" + ] + } + ], + "prompt_number": 83 }, { "cell_type": "markdown", @@ -264,7 +280,7 @@ "metadata": {}, "source": [ "## Empty List\n", - "It is generally not a good idea to use the `==` to check for empty lists. " + "It is generally not a good idea to use the `==` to check for empty lists..." ] }, { @@ -378,7 +394,7 @@ "## List comparison \n", "List comparisons are a handy way to show the difference between `==` and `is`. \n", "While `==` is rather evaluating the equality of the value, `is` is checking if two objects are equal.\n", - "The examples below show that we can assign a pointer to the same list object by using `=`, e.g., `list1 = list2`. If we want to make a copy of the list values, we have to make a little " + "The examples below show that we can assign a pointer to the same list object by using `=`, e.g., `list1 = list2`. If we want to make a copy of the list values, we have to make a little tweak: `list1 = list2[:]`" ] }, { @@ -416,14 +432,6 @@ } ], "prompt_number": 82 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] } ], "metadata": {}