Browse Source

Fix some minor problems

pull/1/MERGE
bushuhui 5 years ago
parent
commit
a382abbd48
13 changed files with 1309 additions and 1555 deletions
  1. +50
    -79
      0_python/1_Basics.ipynb
  2. +18
    -25
      0_python/2_Print_Statement.ipynb
  3. +188
    -82
      0_python/3_Data_Structure_1.ipynb
  4. +45
    -54
      0_python/4_Data_Structure_2.ipynb
  5. +31
    -28
      0_python/5_Control_Flow.ipynb
  6. +62
    -46
      0_python/6_Function.ipynb
  7. +0
    -7
      0_python/7_Class.ipynb
  8. +162
    -106
      1_numpy_matplotlib_scipy_sympy/matplotlib_full.ipynb
  9. +681
    -428
      1_numpy_matplotlib_scipy_sympy/numpy_tutorial.ipynb
  10. +54
    -693
      1_numpy_matplotlib_scipy_sympy/sympy_tutorial.ipynb
  11. +16
    -5
      2_knn/knn_classification.ipynb
  12. +1
    -1
      README.md
  13. +1
    -1
      References.md

+ 50
- 79
0_python/1_Basics.ipynb View File

@@ -4,14 +4,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# The Zen Of Python"
"# Python Basic"
] ]
}, },
{ {
@@ -67,7 +60,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -78,7 +71,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -102,7 +95,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -111,7 +104,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -157,7 +150,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -166,7 +159,7 @@
"3" "3"
] ]
}, },
"execution_count": 6,
"execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -177,7 +170,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -186,7 +179,7 @@
"1" "1"
] ]
}, },
"execution_count": 7,
"execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -197,7 +190,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -206,7 +199,7 @@
"2" "2"
] ]
}, },
"execution_count": 8,
"execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -217,16 +210,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9,
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"0"
"0.5"
] ]
}, },
"execution_count": 9,
"execution_count": 13,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -244,7 +237,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -253,13 +246,13 @@
"0.5" "0.5"
] ]
}, },
"execution_count": 6,
"execution_count": 14,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"1/2"
"1.0/2"
] ]
}, },
{ {
@@ -284,7 +277,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -293,7 +286,7 @@
"5" "5"
] ]
}, },
"execution_count": 11,
"execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -311,7 +304,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -320,7 +313,7 @@
"1.0" "1.0"
] ]
}, },
"execution_count": 12,
"execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -352,10 +345,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": true
},
"execution_count": 17,
"metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"z = 1" "z = 1"
@@ -363,7 +354,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14,
"execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -372,7 +363,7 @@
"True" "True"
] ]
}, },
"execution_count": 14,
"execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -383,7 +374,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15,
"execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -392,7 +383,7 @@
"False" "False"
] ]
}, },
"execution_count": 15,
"execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -424,7 +415,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9,
"execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -434,7 +425,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -453,7 +444,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12,
"execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -462,7 +453,7 @@
"2" "2"
] ]
}, },
"execution_count": 12,
"execution_count": 23,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -484,7 +475,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13,
"execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -493,7 +484,7 @@
"10" "10"
] ]
}, },
"execution_count": 13,
"execution_count": 24,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -543,7 +534,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14,
"execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -552,7 +543,7 @@
"'0xaa'" "'0xaa'"
] ]
}, },
"execution_count": 14,
"execution_count": 25,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -563,7 +554,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21,
"execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -572,7 +563,7 @@
"170" "170"
] ]
}, },
"execution_count": 21,
"execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -583,7 +574,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15,
"execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -592,7 +583,7 @@
"'0o10'" "'0o10'"
] ]
}, },
"execution_count": 15,
"execution_count": 2,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -602,26 +593,6 @@
] ]
}, },
{ {
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"010"
]
},
{
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
@@ -630,7 +601,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24,
"execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -684,7 +655,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26,
"execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -693,7 +664,7 @@
"'b'" "'b'"
] ]
}, },
"execution_count": 26,
"execution_count": 32,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -704,7 +675,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27,
"execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -713,7 +684,7 @@
"98" "98"
] ]
}, },
"execution_count": 27,
"execution_count": 33,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -738,7 +709,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17,
"execution_count": 34,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@@ -766,7 +737,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18,
"execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -791,7 +762,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30,
"execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -800,7 +771,7 @@
"(4, 1)" "(4, 1)"
] ]
}, },
"execution_count": 30,
"execution_count": 36,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -818,7 +789,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19,
"execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -852,7 +823,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21,
"execution_count": 38,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {


+ 18
- 25
0_python/2_Print_Statement.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Print Statement" "# Print Statement"
] ]
}, },
@@ -71,7 +64,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -99,7 +92,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -130,7 +123,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -154,7 +147,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -187,7 +180,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -219,7 +212,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -250,7 +243,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -267,7 +260,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -284,7 +277,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -308,7 +301,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -391,7 +384,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -400,7 +393,7 @@
"'3.121312'" "'3.121312'"
] ]
}, },
"execution_count": 14,
"execution_count": 13,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -418,7 +411,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -427,7 +420,7 @@
"'3.12131'" "'3.12131'"
] ]
}, },
"execution_count": 15,
"execution_count": 14,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -445,7 +438,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -454,7 +447,7 @@
"' 3.12131'" "' 3.12131'"
] ]
}, },
"execution_count": 16,
"execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -551,7 +544,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -560,7 +553,7 @@
"'3.121 '" "'3.121 '"
] ]
}, },
"execution_count": 20,
"execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }


+ 188
- 82
0_python/3_Data_Structure_1.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data Structures" "# Data Structures"
] ]
}, },
@@ -317,7 +310,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15,
"execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -365,7 +358,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17,
"execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -374,7 +367,7 @@
"[0, 3, 6]" "[0, 3, 6]"
] ]
}, },
"execution_count": 17,
"execution_count": 6,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -399,7 +392,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18,
"execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -408,7 +401,7 @@
"10" "10"
] ]
}, },
"execution_count": 18,
"execution_count": 7,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -737,7 +730,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33,
"execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -746,7 +739,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34,
"execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -771,7 +764,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35,
"execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -780,7 +773,7 @@
"3" "3"
] ]
}, },
"execution_count": 35,
"execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -798,7 +791,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36,
"execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -807,7 +800,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -832,7 +825,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38,
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -857,7 +850,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39,
"execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -866,7 +859,7 @@
"0" "0"
] ]
}, },
"execution_count": 39,
"execution_count": 14,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -877,7 +870,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40,
"execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -887,7 +880,7 @@
"traceback": [ "traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-40-344da5bcf759>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlst\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m999\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-15-344da5bcf759>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlst\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m999\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mValueError\u001b[0m: 999 is not in list" "\u001b[0;31mValueError\u001b[0m: 999 is not in list"
] ]
} }
@@ -905,7 +898,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -930,7 +923,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42,
"execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -955,16 +948,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 44,
"execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[1, 1, 4, 8, 7, 'Python', 1, [5, 4, 2, 8], 5, 4]"
"[1, 1, 4, 8, 7, 'Python', 1, [5, 4, 2, 8], 5, 4, 2]"
] ]
}, },
"execution_count": 44,
"execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -983,11 +976,39 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"lst.pop(0)"
"lst.pop(2)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 4, 8, 7, 'Python', 1, [5, 4, 2, 8], 5, 4, 2]\n"
]
}
],
"source": [
"print(lst)"
] ]
}, },
{ {
@@ -999,9 +1020,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 4, 7, 1, [5, 4, 2, 8], 5, 4, 2]\n"
]
}
],
"source": [ "source": [
"lst.remove('Python')\n", "lst.remove('Python')\n",
"print(lst)" "print(lst)"
@@ -1016,15 +1045,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37,
"execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"[1, 1, 4, 8, 7, 'Python', 1, [5, 4, 2, 8], 5, 4]\n",
"[1, 4, 8, 7, 'Python', 1, [5, 4, 2, 8], 5, 4]\n"
"[1, 4, 7, 1, [5, 4, 2, 8], 5, 4, 2]\n",
"[1, 7, 1, [5, 4, 2, 8], 5, 4, 2]\n"
] ]
} }
], ],
@@ -1043,14 +1072,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38,
"execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"[4, 5, [5, 4, 2, 8], 1, 'Python', 7, 8, 4, 1]\n"
"[2, 4, 5, [5, 4, 2, 8], 1, 7, 1]\n"
] ]
} }
], ],
@@ -1070,7 +1099,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40,
"execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1096,7 +1125,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41,
"execution_count": 27,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1121,10 +1150,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['apple', 'orange', 'peach']\n",
"['peach', 'orange', 'apple']\n"
]
}
],
"source": [ "source": [
"names = ['apple', 'orange', 'peach']\n",
"names.sort()\n", "names.sort()\n",
"print(names)\n", "print(names)\n",
"names.sort(reverse=True)\n", "names.sort(reverse=True)\n",
@@ -1140,9 +1179,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['peach', 'apple', 'orange']\n",
"['orange', 'peach', 'apple']\n"
]
}
],
"source": [ "source": [
"names.sort(key=len)\n", "names.sort(key=len)\n",
"print(names)\n", "print(names)\n",
@@ -1166,7 +1214,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 49,
"execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1175,7 +1223,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50,
"execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1200,7 +1248,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 51,
"execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1221,7 +1269,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 52,
"execution_count": 34,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1247,7 +1295,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 53,
"execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1256,7 +1304,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 54,
"execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1274,7 +1322,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55,
"execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1295,7 +1343,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56,
"execution_count": 38,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1326,7 +1374,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57,
"execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1360,7 +1408,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1377,7 +1425,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58,
"execution_count": 41,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1386,7 +1434,7 @@
"(27,)" "(27,)"
] ]
}, },
"execution_count": 58,
"execution_count": 41,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1404,7 +1452,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59,
"execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1413,7 +1461,7 @@
"(27, 27)" "(27, 27)"
] ]
}, },
"execution_count": 59,
"execution_count": 42,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1431,7 +1479,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60,
"execution_count": 43,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -1461,9 +1509,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 44,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n",
"('H', 'e', 'l')\n"
]
}
],
"source": [ "source": [
"print(tup3[1])\n", "print(tup3[1])\n",
"tup5 = tup4[:3]\n", "tup5 = tup4[:3]\n",
@@ -1479,7 +1536,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61,
"execution_count": 45,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1488,7 +1545,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62,
"execution_count": 46,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1505,9 +1562,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 47,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('R', 'a', 'j', 'a', 't', 'h', 'K', 'u', 'm', 'a', 'r', 'M', 'P')\n"
]
}
],
"source": [ "source": [
"d = tuple('RajathKumarMP')\n", "d = tuple('RajathKumarMP')\n",
"print(d)" "print(d)"
@@ -1588,7 +1653,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 64,
"execution_count": 48,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1620,7 +1685,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 65,
"execution_count": 55,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1629,7 +1694,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 66,
"execution_count": 50,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1645,7 +1710,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 67,
"execution_count": 52,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1654,7 +1719,7 @@
"{1, 2, 3, 4, 5}" "{1, 2, 3, 4, 5}"
] ]
}, },
"execution_count": 67,
"execution_count": 52,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1672,21 +1737,29 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 68,
"execution_count": 56,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout",
"output_type": "stream",
"text": [
"{1, 2, 3}\n"
]
},
{
"data": { "data": {
"text/plain": [ "text/plain": [
"{0, 1, 2, 3}" "{0, 1, 2, 3}"
] ]
}, },
"execution_count": 68,
"execution_count": 56,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"print(set1)\n",
"set1.add(0)\n", "set1.add(0)\n",
"set1" "set1"
] ]
@@ -1700,7 +1773,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 69,
"execution_count": 57,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1709,7 +1782,7 @@
"{2, 3}" "{2, 3}"
] ]
}, },
"execution_count": 69,
"execution_count": 57,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1727,7 +1800,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 70,
"execution_count": 58,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1736,7 +1809,7 @@
"{0, 1}" "{0, 1}"
] ]
}, },
"execution_count": 70,
"execution_count": 58,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1754,9 +1827,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 59,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{0, 1, 4, 5}"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"set2.symmetric_difference(set1)" "set2.symmetric_difference(set1)"
] ]
@@ -1770,9 +1854,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 60,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"set1.issubset(set2)" "set1.issubset(set2)"
] ]
@@ -1838,9 +1933,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"execution_count": 61,
"metadata": {}, "metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"set()"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"set1.clear()\n", "set1.clear()\n",
"set1" "set1"


+ 45
- 54
0_python/4_Data_Structure_2.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Strings" "## Strings"
] ]
}, },
@@ -23,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -36,7 +29,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -66,7 +59,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -99,7 +92,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -330,7 +323,7 @@
"traceback": [ "traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-6062e7a32deb>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Taj'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mahal'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mprint\u001b[0m \u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mahal'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m20\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-12-a7d6b97b4839>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Taj'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mahal'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mString0\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mahal'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m20\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mValueError\u001b[0m: substring not found" "\u001b[0;31mValueError\u001b[0m: substring not found"
] ]
} }
@@ -426,7 +419,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -435,7 +428,7 @@
"'*a_a-'" "'*a_a-'"
] ]
}, },
"execution_count": 11,
"execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -446,7 +439,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12,
"execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -455,7 +448,7 @@
"'1\\n2'" "'1\\n2'"
] ]
}, },
"execution_count": 12,
"execution_count": 6,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -480,7 +473,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13,
"execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -508,7 +501,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14,
"execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -533,7 +526,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15,
"execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -611,7 +604,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -620,7 +613,7 @@
"'TAJ MAHAL IS BEAUTIFUL'" "'TAJ MAHAL IS BEAUTIFUL'"
] ]
}, },
"execution_count": 22,
"execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -638,7 +631,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -647,7 +640,7 @@
"'Bengaluru is beautiful'" "'Bengaluru is beautiful'"
] ]
}, },
"execution_count": 23,
"execution_count": 22,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -665,10 +658,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": true
},
"execution_count": 23,
"metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"f = ' hello '" "f = ' hello '"
@@ -683,7 +674,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25,
"execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -692,7 +683,7 @@
"'hello'" "'hello'"
] ]
}, },
"execution_count": 25,
"execution_count": 24,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -710,7 +701,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -719,7 +710,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -728,7 +719,7 @@
"' ***----hello---******* '" "' ***----hello---******* '"
] ]
}, },
"execution_count": 5,
"execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -746,7 +737,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7,
"execution_count": 27,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -772,7 +763,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29,
"execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -812,7 +803,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17,
"execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -838,14 +829,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23,
"execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'One': 1, 'OneTwo': 12}\n"
"{'OneTwo': 12, 'One': 1}\n"
] ]
} }
], ],
@@ -857,14 +848,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21,
"execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'key2': [1, 2, 4], 3: (1, 4, 6), 'key1': 1}\n"
"{'key1': 1, 3: (1, 4, 6), 'key2': [1, 2, 4]}\n"
] ]
} }
], ],
@@ -882,7 +873,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24,
"execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -906,7 +897,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25,
"execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -923,14 +914,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27,
"execution_count": 34,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'Two': 2, 'One': 1, 'Five': 5, 'Four': 4, 'Three': 3}\n"
"{'One': 1, 'Five': 5, 'Four': 4, 'Three': 3, 'Two': 2}\n"
] ]
} }
], ],
@@ -950,7 +941,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29,
"execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -982,7 +973,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30,
"execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1007,14 +998,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31,
"execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'Two': 2, 'One': 1, 'Five': 5, 'Four': 4, 'Three': 3}\n"
"{'One': 1, 'Five': 5, 'Four': 4, 'Three': 3, 'Two': 2}\n"
] ]
} }
], ],
@@ -1039,7 +1030,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[4, 5, 3, 2, 1]"
"dict_values([1, 5, 4, 3, 2])"
] ]
}, },
"execution_count": 38, "execution_count": 38,
@@ -1066,7 +1057,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"['Four', 'Five', 'Three', 'Two', 'One']"
"dict_keys(['One', 'Five', 'Four', 'Three', 'Two'])"
] ]
}, },
"execution_count": 39, "execution_count": 39,
@@ -1087,18 +1078,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33,
"execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"[ Two] 2\n",
"[ One] 1\n", "[ One] 1\n",
"[ Five] 5\n", "[ Five] 5\n",
"[ Four] 4\n", "[ Four] 4\n",
"[ Three] 3\n"
"[ Three] 3\n",
"[ Two] 2\n"
] ]
} }
], ],
@@ -1118,14 +1109,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34,
"execution_count": 41,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'Two': 2, 'One': 1, 'Five': 5, 'Three': 3}\n",
"{'One': 1, 'Five': 5, 'Three': 3, 'Two': 2}\n",
"4\n" "4\n"
] ]
} }


+ 31
- 28
0_python/5_Control_Flow.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Control Flow Statements" "# Control Flow Statements"
] ]
}, },
@@ -199,7 +192,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -221,7 +214,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -250,7 +243,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -278,7 +271,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -322,7 +315,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -331,7 +324,15 @@
"text": [ "text": [
"1\n", "1\n",
"4\n", "4\n",
"Bye\n"
"Bye\n",
"looping 4\n",
"looping 5\n",
"looping 6\n",
"looping 7\n",
"looping 8\n",
"looping 9\n",
"looping 10\n",
"looping 11\n"
] ]
} }
], ],
@@ -345,9 +346,11 @@
"# do-untile\n", "# do-untile\n",
"while True:\n", "while True:\n",
" #do something\n", " #do something\n",
" i = i+1\n",
" print('looping %3d' % i)\n",
" \n", " \n",
" # check \n", " # check \n",
" if xxxx: break"
" if i>10: break"
] ]
}, },
{ {
@@ -366,7 +369,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -386,7 +389,7 @@
], ],
"source": [ "source": [
"for i in range(100):\n", "for i in range(100):\n",
" print i\n",
" print(i)\n",
" if i>=7:\n", " if i>=7:\n",
" break" " break"
] ]
@@ -407,7 +410,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10,
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -452,7 +455,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8,
"execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -480,7 +483,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9,
"execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -489,7 +492,7 @@
"[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]" "[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]"
] ]
}, },
"execution_count": 9,
"execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -514,7 +517,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -523,7 +526,7 @@
"[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]" "[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]"
] ]
}, },
"execution_count": 10,
"execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -534,7 +537,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"execution_count": 17,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -554,7 +557,7 @@
" '81': 81}" " '81': 81}"
] ]
}, },
"execution_count": 11,
"execution_count": 17,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -565,7 +568,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13,
"execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -574,7 +577,7 @@
"(27, 54, 81, 108, 135, 162, 189, 216, 243, 270)" "(27, 54, 81, 108, 135, 162, 189, 216, 243, 270)"
] ]
}, },
"execution_count": 13,
"execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -592,7 +595,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14,
"execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -601,7 +604,7 @@
"[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]" "[27, 54, 81, 108, 135, 162, 189, 216, 243, 270]"
] ]
}, },
"execution_count": 14,
"execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }


+ 62
- 46
0_python/6_Function.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Functions" "# Functions"
] ]
}, },
@@ -81,7 +74,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -92,7 +85,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -100,12 +93,16 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Hey Rajath!\n", "Hey Rajath!\n",
"Rajath, How do you do?\n",
"Hey Rajath!\n",
"Rajath, How do you do?\n" "Rajath, How do you do?\n"
] ]
} }
], ],
"source": [ "source": [
"firstfunc()"
"firstfunc()\n",
"funca=firstfunc\n",
"funca()"
] ]
}, },
{ {
@@ -117,10 +114,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"execution_count": 6,
"metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def firstfunc(username):\n", "def firstfunc(username):\n",
@@ -130,14 +125,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Please enter your name : Guido\n"
"Please enter your name : Bu\n"
] ]
} }
], ],
@@ -154,15 +149,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Hey Guido!\n",
"Guido, How do you do?\n"
"Hey Bu!\n",
"Bu, How do you do?\n"
] ]
} }
], ],
@@ -226,7 +221,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -244,7 +239,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5,
"execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -276,7 +271,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -312,7 +307,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -333,7 +328,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -349,7 +344,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12,
"execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -358,7 +353,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13,
"execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -367,7 +362,7 @@
" lowest = min(eglist)\n", " lowest = min(eglist)\n",
" first = eglist[0]\n", " first = eglist[0]\n",
" last = eglist[-1]\n", " last = eglist[-1]\n",
" return highest,lowest,first,last"
" return (highest,lowest,first,last)"
] ]
}, },
{ {
@@ -379,7 +374,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16,
"execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -432,7 +427,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17,
"execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -456,7 +451,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18,
"execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -465,7 +460,7 @@
"7" "7"
] ]
}, },
"execution_count": 18,
"execution_count": 22,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -537,7 +532,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21,
"execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -559,7 +554,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22,
"execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -575,7 +570,7 @@
"15" "15"
] ]
}, },
"execution_count": 22,
"execution_count": 25,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -586,7 +581,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23,
"execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -602,7 +597,7 @@
"6" "6"
] ]
}, },
"execution_count": 23,
"execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -627,7 +622,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36,
"execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -643,7 +638,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37,
"execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -667,17 +662,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38,
"execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"This is happening before the function is called : [1, 3, 5, 6]\n",
"This is happening inside the function : [1, 3, 5, 6, 6]\n",
"This is happening outside the function : [1, 3, 5, 6]\n",
"[1, 2, 3, 4, 5]\n"
"This is happening before the function is called : [1, 2, 3, 4, 5, 7]\n",
"This is happening inside the function : [1, 2, 3, 4, 5, 7, 6]\n",
"This is happening outside the function : [1, 2, 3, 4, 5, 7]\n",
"[1, 2, 3, 4, 5, 7]\n"
] ]
} }
], ],
@@ -766,7 +761,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40,
"execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -775,7 +770,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41,
"execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -784,7 +779,7 @@
"64" "64"
] ]
}, },
"execution_count": 41,
"execution_count": 36,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -795,6 +790,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(6, 8)"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zz = lambda x, y: (x*y, x**y)\n",
"zz(2, 3)"
]
},
{
"cell_type": "code",
"execution_count": 42, "execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [


+ 0
- 7
0_python/7_Class.ipynb View File

@@ -4,13 +4,6 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"All the IPython Notebooks in this lecture series are available at https://github.com/rajathkumarmp/Python-Lectures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Classes" "# Classes"
] ]
}, },


+ 162
- 106
1_numpy_matplotlib_scipy_sympy/matplotlib_full.ipynb
File diff suppressed because it is too large
View File


+ 681
- 428
1_numpy_matplotlib_scipy_sympy/numpy_tutorial.ipynb
File diff suppressed because it is too large
View File


+ 54
- 693
1_numpy_matplotlib_scipy_sympy/sympy_tutorial.ipynb
File diff suppressed because it is too large
View File


+ 16
- 5
2_knn/knn_classification.ipynb View File

@@ -7,7 +7,7 @@
"# kNN Classification\n", "# kNN Classification\n",
"\n", "\n",
"\n", "\n",
"K最近邻(k-Nearest Neighbor,kNN)分类算法,是一个理论上比较成熟的方法,也是最简单的机器学习算法之一。该方法的思路是:如果一个样本在特征空间中的k个最相似(即特征空间中最邻近)的样本中的大多数属于某一个类别,则该样本也属于这个类别。KNN算法中,所选择的邻居都是已经正确分类的对象。该方法在定类决策上只依据最邻近的一个或者几个样本的类别来决定待分样本所属的类别。 KNN方法虽然从原理上也依赖于极限定理,但在类别决策时,只与极少量的相邻样本有关。由于KNN方法主要靠周围有限的邻近的样本,而不是靠判别类域的方法来确定所属类别的,因此对于类域的交叉或重叠较多的待分样本集来说,KNN方法较其他方法更为适合。\n",
"K最近邻(k-Nearest Neighbor,kNN)分类算法,是一个理论上比较成熟的方法,也是最简单的机器学习算法之一。该方法的思路是:***如果一个样本在特征空间中的k个最相似(即特征空间中最邻近)的样本中的大多数属于某一个类别,则该样本也属于这个类别***。KNN方法虽然从原理上也依赖于极限定理,但在类别决策时,只与极少量的相邻样本有关。由于KNN方法主要靠周围有限的邻近的样本,而不是靠判别类域的方法来确定所属类别的,因此对于类域的交叉或重叠较多的待分样本集来说,KNN方法较其他方法更为适合。\n",
"\n", "\n",
"kNN算法不仅可以用于分类,还可以用于回归。通过找出一个样本的k个最近邻居,将这些邻居的属性的平均值赋给该样本,就可以得到该样本的属性。更有用的方法是将不同距离的邻居对该样本产生的影响给予不同的权值(weight),如权值与距离成正比(组合函数)。\n", "kNN算法不仅可以用于分类,还可以用于回归。通过找出一个样本的k个最近邻居,将这些邻居的属性的平均值赋给该样本,就可以得到该样本的属性。更有用的方法是将不同距离的邻居对该样本产生的影响给予不同的权值(weight),如权值与距离成正比(组合函数)。\n",
"\n", "\n",
@@ -16,10 +16,14 @@
"k-NN可以说是一种最直接的用来分类未知数据的方法。基本通过下面这张图跟文字说明就可以明白K-NN是干什么的\n", "k-NN可以说是一种最直接的用来分类未知数据的方法。基本通过下面这张图跟文字说明就可以明白K-NN是干什么的\n",
"![knn](images/knn.png)\n", "![knn](images/knn.png)\n",
"\n", "\n",
"简单来说,k-NN可以看成:有那么一堆你已经知道分类的数据,然后当一个新数据进入的时候,就开始跟训练数据里的每个点求距离,然后挑离这个训练数据最近的K个点看看这几个点属于什么类型,然后用少数服从多数的原则,给新数据归类。\n",
"\n",
"\n",
"算法步骤:\n",
"简单来说,k-NN可以看成:**有那么一堆你已经知道分类的数据,然后当一个新数据进入的时候,就开始跟训练数据里的每个点求距离,然后挑离这个训练数据最近的K个点看看这几个点属于什么类型,然后用少数服从多数的原则,给新数据归类**。\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 算法步骤:\n",
"\n", "\n",
"* step.1---初始化距离为最大值\n", "* step.1---初始化距离为最大值\n",
"* step.2---计算未知样本和每个训练样本的距离dist\n", "* step.2---计算未知样本和每个训练样本的距离dist\n",
@@ -31,6 +35,13 @@
] ]
}, },
{ {
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate sample data"
]
},
{
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": {}, "metadata": {},


+ 1
- 1
README.md View File

@@ -22,7 +22,7 @@
- [matplotlib](1_numpy_matplotlib_scipy_sympy/matplotlib_simple_tutorial.ipynb) - [matplotlib](1_numpy_matplotlib_scipy_sympy/matplotlib_simple_tutorial.ipynb)
- [ipython & notebook](1_numpy_matplotlib_scipy_sympy/ipython_notebook.ipynb) - [ipython & notebook](1_numpy_matplotlib_scipy_sympy/ipython_notebook.ipynb)
3. [knn](2_knn/knn_classification.ipynb) 3. [knn](2_knn/knn_classification.ipynb)
4. [kMenas](3_kmeans/knn_classification.ipynb)
4. [kMenas](3_kmeans/k-means.ipynb)
5. [Logistic Regression](4_logistic_regression/) 5. [Logistic Regression](4_logistic_regression/)
- [Least squares](4_logistic_regression/Least_squares.ipynb) - [Least squares](4_logistic_regression/Least_squares.ipynb)
- [Logistic regression](4_logistic_regression/Logistic_regression.ipynb) - [Logistic regression](4_logistic_regression/Logistic_regression.ipynb)


+ 1
- 1
References.md View File

@@ -62,7 +62,7 @@
* [CS 294: Deep Reinforcement Learning, UC Berkeley](http://rll.berkeley.edu/deeprlcourse/) * [CS 294: Deep Reinforcement Learning, UC Berkeley](http://rll.berkeley.edu/deeprlcourse/)
* [Deep Learning Book](https://github.com/exacity/deeplearningbook-chinese) * [Deep Learning Book](https://github.com/exacity/deeplearningbook-chinese)
* [Machine Learning Crash Course with TensorFlow APIs](https://developers.google.cn/machine-learning/crash-course/) * [Machine Learning Crash Course with TensorFlow APIs](https://developers.google.cn/machine-learning/crash-course/)
* [ Nvidia DLI](https://www.nvidia.com/zh-cn/deep-learning-ai/education/)
* [Nvidia DLI](https://www.nvidia.com/zh-cn/deep-learning-ai/education/)
* [Introduction to Machine Learning](https://webdocs.cs.ualberta.ca/~nray1/CMPUT466_551.htm) * [Introduction to Machine Learning](https://webdocs.cs.ualberta.ca/~nray1/CMPUT466_551.htm)
* [Computer Vision @ ETHZ](http://cvg.ethz.ch/teaching/compvis/) * [Computer Vision @ ETHZ](http://cvg.ethz.ch/teaching/compvis/)
* [SFMedu: A Structure from Motion System for Education](http://robots.princeton.edu/courses/SFMedu/) * [SFMedu: A Structure from Motion System for Education](http://robots.princeton.edu/courses/SFMedu/)


Loading…
Cancel
Save