Commit 94540f77 authored by Jens Ehlers's avatar Jens Ehlers
Browse files

Python intro update

parent 036628b2
......@@ -390,7 +390,8 @@
}
],
"source": [
"{\"apple\": \"a fruit\", \"banana\": \"an herb\", \"monkey\": \"a mammal\"}"
"a = {\"apple\": \"a fruit\", \"banana\": \"an herb\", \"monkey\": \"a mammal\"}\n",
"a"
]
},
{
......@@ -415,7 +416,7 @@
}
],
"source": [
"{\"apple\": \"a fruit\", \"banana\": \"an herb\", \"monkey\": \"a mammal\"}[\"apple\"]"
"a[\"apple\"]"
]
},
{
......@@ -673,10 +674,9 @@
"source": [
"**How to Read Python Error Messages**\n",
"\n",
"Python error messages \n",
"`TypeError: Can't convert 'int' object to str implicitly`\n",
"Python error messages `TypeError: can only concatenate str (not \"int\") to str`\n",
"\n",
"Above the error message is the \"traceback\" also called the \"call stack\". This is a representation of the sequence of procedure calls that lead to the error. If the procedure call originated from code from a file, the filename would be listed after the word \"File\" on each line. If the procedure call originated from a notebook cell, then the word \"ipython-input-...\".\n"
"Above the error message is the \"traceback\" also called the \"call stack\". This is a representation of the sequence of procedure calls that lead to the error. If the procedure call originated from code from a file, the filename would be listed after the word \"File\" on each line. If the procedure call originated from a notebook cell, then we see the \"ipython-input-...\".\n"
]
},
{
......@@ -811,8 +811,8 @@
"text": [
"<>:1: SyntaxWarning: \"is\" with a literal. Did you mean \"==\"?\n",
"<>:1: SyntaxWarning: \"is\" with a literal. Did you mean \"==\"?\n",
"<ipython-input-26-e351903fd900>:1: SyntaxWarning: \"is\" with a literal. Did you mean \"==\"?\n",
" (1, 2) is (1, 2) # tuples compared by value\n"
"<ipython-input-26-39c6e37b4335>:1: SyntaxWarning: \"is\" with a literal. Did you mean \"==\"?\n",
" (1, 2) is (1, 2) # if tuples are compared by reference or value, depends on your Python version\n"
]
},
{
......@@ -827,7 +827,7 @@
}
],
"source": [
"(1, 2) is (1, 2) # tuples compared by value"
"(1, 2) is (1, 2) # if tuples are compared by reference or value, depends on your Python version"
]
},
{
......@@ -1113,7 +1113,7 @@
{
"data": {
"text/plain": [
"<generator object function at 0x000002122AA82900>"
"<generator object function at 0x0000017816A305F0>"
]
},
"execution_count": 36,
......@@ -1404,7 +1404,7 @@
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x21229948be0>]"
"[<matplotlib.lines.Line2D at 0x17858c222b0>]"
]
},
"execution_count": 48,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment