├── website ├── _environment ├── .gitignore ├── modules │ ├── module-4 │ │ ├── pandas-data.qmd │ │ ├── index.qmd │ │ ├── data-types-and-pandas.qmd │ │ └── group-by-data-transformation.qmd │ ├── module-1 │ │ └── simple_script.py │ ├── module-3 │ │ ├── index.qmd │ │ ├── installing-numpy.qmd │ │ └── universal-functions.qmd │ └── module-2 │ │ ├── sets.qmd │ │ └── python-statements-and-syntax.qmd ├── _site │ ├── robots.txt │ ├── imgs │ │ ├── ss.jpg │ │ ├── sl.jpeg │ │ ├── jupyter.png │ │ ├── vscode.png │ │ ├── spyder_ide.png │ │ ├── jupyter_in_vscode.png │ │ ├── anaconda_navigator.png │ │ └── python-module-icon-light.svg │ └── site_libs │ │ ├── bootstrap │ │ ├── bootstrap-icons.woff │ │ └── imgs │ │ │ ├── python-module-icon-light.svg │ │ │ └── python-module-icon-dark.svg │ │ └── quarto-html │ │ └── tippy.css ├── imgs │ ├── sl.jpeg │ ├── ss.jpg │ ├── vscode.png │ ├── jupyter.png │ ├── conda_env_0.png │ ├── conda_env_1.png │ ├── github_repo.png │ ├── spyder_ide.png │ ├── simple_script.png │ ├── anaconda_distro.png │ ├── clone_with_url.png │ ├── github_desktop.png │ ├── github_features.png │ ├── github_options.png │ ├── ipython_session.png │ ├── python_session.png │ ├── simple_script.png_ │ ├── anaconda_nav_env_0.png │ ├── anaconda_nav_env_1.png │ ├── anaconda_navigator.png │ ├── jupyter_in_vscode.png │ ├── official_installer.png │ ├── anaconda_navigator.png_ │ ├── fetch_name_and_clone.png │ ├── github_desktop_login.png │ ├── python-module-icon-light.svg │ └── python-module-icon-dark.svg ├── docs │ ├── site_libs │ │ ├── bootstrap │ │ │ └── bootstrap-icons.woff │ │ └── quarto-html │ │ │ └── tippy.css │ └── styles.css ├── course │ ├── team.qmd │ └── schedule.qmd ├── styles.css └── theme-switcher.js ├── notes ├── my_data.csv ├── snippet.py ├── data.bin ├── A.npy ├── AAT.npz ├── AB.npz ├── ABC.npz ├── .DS_Store ├── notes.pdf ├── jupyter.png ├── vscode.png ├── data │ ├── .DS_Store │ └── python.dat ├── conda_env_0.png ├── conda_env_1.png ├── github_repo.png ├── simple_script.png ├── anaconda_distro.png ├── clone_with_url.png ├── github_desktop.png ├── github_features.png ├── github_options.png ├── ipython_session.png ├── python_session.png ├── simple_script.png_ ├── anaconda_nav_env_0.png ├── anaconda_nav_env_1.png ├── anaconda_navigator.png ├── jupyter_in_vscode.png ├── official_installer.png ├── anaconda_navigator.png_ ├── fetch_name_and_clone.png ├── github_desktop_login.png ├── my_data ├── _minted-notes │ ├── B910E29F9AEAD48BB0C6192429850F9D764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 4BA959FC9F1D6EC5C0E4BE5CBBFEF515764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 4BA959FC9F1D6EC5C0E4BE5CBBFEF515B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 50DA700E56856207B8578FFAE39EF61F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 50DA700E56856207B8578FFAE39EF61FB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 832FFA4A3FC6E953628C947A3EE992B1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 0FEE1DB0482A67422C8836DCF236E9D1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 46CE52F14D83D9F4CA144B1AD458B74C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 46CE52F14D83D9F4CA144B1AD458B74CB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 8E7D3D59DECDC496828A28CF5B8BA78BB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 2EDC601BD8BA9A6CC48DCCE9809F7026764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 7026C1620E60A8E48355E59E72FAEF28764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── B06E57E23320B56BB43F698290A04840764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 3F680C2693DE03692D6A2B0A236EDB37764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── A35A6456F62A0A5D8BD1E5EB4F7FFD78764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── EB1BCEA24A3FB4E97B25667DEB68FB6A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 7422D78E46051525105100B3E707158F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 7422D78E46051525105100B3E707158FB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 6359399BA5B53D38F60488A7CCD99CFE764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 8D6739466FF81933615C9E5DADDAD73F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 6359399BA5B53D38F60488A7CCD99CFEB8572376E7183A887D9D0939E390FA18.pygtex │ ├── D96A2987C6EB9036EF242D8F811649AD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── C5FEA50408BF7DE712BC7545A5830BAC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 06BD3D91D2D5B97927C7A9262973A042764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 27B642D0B8B0E1D8D32730ADB59FABB9B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 26B748FF565D4068675B1B7D7E8BE165764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 26B748FF565D4068675B1B7D7E8BE165B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 91D9D88AB44D89D91E45ACBC50CB296C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 91D9D88AB44D89D91E45ACBC50CB296CB8572376E7183A887D9D0939E390FA18.pygtex │ ├── C010F00FC0E42B0602FD04CB97C4C966764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── C010F00FC0E42B0602FD04CB97C4C966B8572376E7183A887D9D0939E390FA18.pygtex │ ├── D41D8CD98F00B204E9800998ECF8427EB8572376E7183A887D9D0939E390FA18.pygtex │ ├── B5ACEFC255B8C347ED43479B42697F2E764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── B5ACEFC255B8C347ED43479B42697F2EB8572376E7183A887D9D0939E390FA18.pygtex │ ├── D96A2987C6EB9036EF242D8F811649ADB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 872ADDC5215F6893FBD1B486E3A513CC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 1F9F889A329993A23E484B930F0DF797764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 693CD82CBEF067F12E39878ED8471163764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 693CD82CBEF067F12E39878ED8471163B8572376E7183A887D9D0939E390FA18.pygtex │ ├── A3CF788BDDE65300804B48B0EF48D5CD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 9A0921ED6CBF467052DC954066B1D4B1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── D6F8B83836AC49D2EF7E7C99B596F8A4764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 3B7B739304A11ED4A4CDFBEE7DBEFB75764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 8DE09300C5C269322DFCCFA8E4CA8709764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 27B642D0B8B0E1D8D32730ADB59FABB9764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── EDE8E363B921494EBA7F7D843B42DC8E764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 6C4FE0567213F2340087B75669A155D3B8572376E7183A887D9D0939E390FA18.pygtex │ ├── EDE8E363B921494EBA7F7D843B42DC8EB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 82837FE20863933F1E2DDF8F5B6F3121764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 82837FE20863933F1E2DDF8F5B6F3121B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 2CF761A7A0EC9D31984A9B71ECC3ECFC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 2CF761A7A0EC9D31984A9B71ECC3ECFCB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 4D06FA9D4193AC53EAB0288005BCBBF2B8572376E7183A887D9D0939E390FA18.pygtex │ ├── A4AE5492CB42844DAD7B13205B950062B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 1A96ECB8032A91326FEBEAB60961966D764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 1A96ECB8032A91326FEBEAB60961966DB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 515895B1D8C40802B4ABEB29B92AECE8764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 2412612A10D149EBD64F4851B8398DBC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 3669482A35653C3123AD335BC5937445B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 6F4095632B64C1C9C7D76FB5A0673106764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 6F4095632B64C1C9C7D76FB5A0673106B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 72E7C98E513837B5FA723ADEA03DAB19764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── A32FDE08938F9AF90BAC21ECE523C061764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 13ACDD6E77E86DB548E01BB8E6686AADB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 815D703D9A02BE8170DDD725F121D741764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── A32FDE08938F9AF90BAC21ECE523C061B8572376E7183A887D9D0939E390FA18.pygtex │ ├── C242DD3276A444CA35DF51DE6CE64CCCB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 219B793E758A81220EF9F461F9684F95B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 815D703D9A02BE8170DDD725F121D741B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 3669482A35653C3123AD335BC5937445764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 299B0631796C987E50C0FE86A50ADA35764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 299B0631796C987E50C0FE86A50ADA35B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 78D2A57E659E3ECFFC57BE2B8A8146FB764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── A4AE5492CB42844DAD7B13205B950062764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 3F680C2693DE03692D6A2B0A236EDB37B8572376E7183A887D9D0939E390FA18.pygtex │ ├── D59E1B047169E16DD6A0E06D6D6068A3764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── D9AB99930269DBCE855E8129343E594A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 1F9F889A329993A23E484B930F0DF797B8572376E7183A887D9D0939E390FA18.pygtex │ ├── E320E8328B93103498FE167469E65BB2764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── E320E8328B93103498FE167469E65BB2B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 13ACDD6E77E86DB548E01BB8E6686AAD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── D59B78B46668A255A2DBA9FE73776612764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── D59B78B46668A255A2DBA9FE73776612B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 8E7D3D59DECDC496828A28CF5B8BA78B764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 019F1608FBF8EB28D01B10AD91BDB35C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 019F1608FBF8EB28D01B10AD91BDB35CB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 2412612A10D149EBD64F4851B8398DBCB8572376E7183A887D9D0939E390FA18.pygtex │ ├── DBE2334814879018F08053510C443709764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── DBE2334814879018F08053510C443709B8572376E7183A887D9D0939E390FA18.pygtex │ ├── C10F51FD5313FD897394FF2504599BFB764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── C10F51FD5313FD897394FF2504599BFBB8572376E7183A887D9D0939E390FA18.pygtex │ ├── D59E1B047169E16DD6A0E06D6D6068A3B8572376E7183A887D9D0939E390FA18.pygtex │ ├── 4505B9A259935687DC37B0F76DBD07D8764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 4505B9A259935687DC37B0F76DBD07D8B8572376E7183A887D9D0939E390FA18.pygtex │ ├── FBA5F4FB84AEF234D445AC316EB88E44764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── FBA5F4FB84AEF234D445AC316EB88E44B8572376E7183A887D9D0939E390FA18.pygtex │ ├── FAFEF3CE429BB45945B4330A94B0E509764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── FAFEF3CE429BB45945B4330A94B0E509B8572376E7183A887D9D0939E390FA18.pygtex │ ├── ACA6C0BE78748B6180D6E41632D80BC0764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 110AC5DB8237DD890B9C771E85CFF14A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── 110AC5DB8237DD890B9C771E85CFF14AB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 6C4FE0567213F2340087B75669A155D3764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── AD7C409334E078678AFF5AC7B16A28DEB8572376E7183A887D9D0939E390FA18.pygtex │ ├── 731064C23BCBBE64237ED22B2A83408B764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex │ ├── A3CF788BDDE65300804B48B0EF48D5CDB8572376E7183A887D9D0939E390FA18.pygtex │ ├── AC16DBA75C89B2466264D0F56F243AEBB8572376E7183A887D9D0939E390FA18.pygtex │ └── AD7C409334E078678AFF5AC7B16A28DE764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex ├── notes.listing └── notes.ent ├── .DS_Store ├── env.yml ├── .vscode └── settings.json ├── LICENSE └── CLAUDE.md /website/_environment: -------------------------------------------------------------------------------- 1 | ind216 -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | /.quarto/ 2 | -------------------------------------------------------------------------------- /website/modules/module-4/pandas-data.qmd: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notes/my_data.csv: -------------------------------------------------------------------------------- 1 | x,y 2 | 0,A 3 | 1,B 4 | 2,C 5 | -------------------------------------------------------------------------------- /notes/snippet.py: -------------------------------------------------------------------------------- 1 | 2 | gr.aggregate([np.sum, np.mean, np.std]) -------------------------------------------------------------------------------- /notes/data.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/.DS_Store -------------------------------------------------------------------------------- /notes/A.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/A.npy -------------------------------------------------------------------------------- /notes/AAT.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/AAT.npz -------------------------------------------------------------------------------- /notes/AB.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/AB.npz -------------------------------------------------------------------------------- /notes/ABC.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/ABC.npz -------------------------------------------------------------------------------- /notes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/.DS_Store -------------------------------------------------------------------------------- /notes/notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/notes.pdf -------------------------------------------------------------------------------- /notes/jupyter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/jupyter.png -------------------------------------------------------------------------------- /notes/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/vscode.png -------------------------------------------------------------------------------- /website/_site/robots.txt: -------------------------------------------------------------------------------- 1 | Sitemap: https://simonesantoni.github.io/intro-to-Python-IND216/sitemap.xml 2 | -------------------------------------------------------------------------------- /notes/data/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/data/.DS_Store -------------------------------------------------------------------------------- /website/imgs/sl.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/sl.jpeg -------------------------------------------------------------------------------- /website/imgs/ss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/ss.jpg -------------------------------------------------------------------------------- /notes/conda_env_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/conda_env_0.png -------------------------------------------------------------------------------- /notes/conda_env_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/conda_env_1.png -------------------------------------------------------------------------------- /notes/github_repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/github_repo.png -------------------------------------------------------------------------------- /notes/simple_script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/simple_script.png -------------------------------------------------------------------------------- /website/imgs/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/vscode.png -------------------------------------------------------------------------------- /notes/anaconda_distro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/anaconda_distro.png -------------------------------------------------------------------------------- /notes/clone_with_url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/clone_with_url.png -------------------------------------------------------------------------------- /notes/github_desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/github_desktop.png -------------------------------------------------------------------------------- /notes/github_features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/github_features.png -------------------------------------------------------------------------------- /notes/github_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/github_options.png -------------------------------------------------------------------------------- /notes/ipython_session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/ipython_session.png -------------------------------------------------------------------------------- /notes/python_session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/python_session.png -------------------------------------------------------------------------------- /notes/simple_script.png_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/simple_script.png_ -------------------------------------------------------------------------------- /website/_site/imgs/ss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/ss.jpg -------------------------------------------------------------------------------- /website/imgs/jupyter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/jupyter.png -------------------------------------------------------------------------------- /notes/anaconda_nav_env_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/anaconda_nav_env_0.png -------------------------------------------------------------------------------- /notes/anaconda_nav_env_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/anaconda_nav_env_1.png -------------------------------------------------------------------------------- /notes/anaconda_navigator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/anaconda_navigator.png -------------------------------------------------------------------------------- /notes/jupyter_in_vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/jupyter_in_vscode.png -------------------------------------------------------------------------------- /notes/official_installer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/official_installer.png -------------------------------------------------------------------------------- /website/_site/imgs/sl.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/sl.jpeg -------------------------------------------------------------------------------- /website/imgs/conda_env_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/conda_env_0.png -------------------------------------------------------------------------------- /website/imgs/conda_env_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/conda_env_1.png -------------------------------------------------------------------------------- /website/imgs/github_repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/github_repo.png -------------------------------------------------------------------------------- /website/imgs/spyder_ide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/spyder_ide.png -------------------------------------------------------------------------------- /notes/anaconda_navigator.png_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/anaconda_navigator.png_ -------------------------------------------------------------------------------- /notes/fetch_name_and_clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/fetch_name_and_clone.png -------------------------------------------------------------------------------- /notes/github_desktop_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/notes/github_desktop_login.png -------------------------------------------------------------------------------- /website/_site/imgs/jupyter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/jupyter.png -------------------------------------------------------------------------------- /website/_site/imgs/vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/vscode.png -------------------------------------------------------------------------------- /website/imgs/simple_script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/simple_script.png -------------------------------------------------------------------------------- /website/_site/imgs/spyder_ide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/spyder_ide.png -------------------------------------------------------------------------------- /website/imgs/anaconda_distro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/anaconda_distro.png -------------------------------------------------------------------------------- /website/imgs/clone_with_url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/clone_with_url.png -------------------------------------------------------------------------------- /website/imgs/github_desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/github_desktop.png -------------------------------------------------------------------------------- /website/imgs/github_features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/github_features.png -------------------------------------------------------------------------------- /website/imgs/github_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/github_options.png -------------------------------------------------------------------------------- /website/imgs/ipython_session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/ipython_session.png -------------------------------------------------------------------------------- /website/imgs/python_session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/python_session.png -------------------------------------------------------------------------------- /website/imgs/simple_script.png_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/simple_script.png_ -------------------------------------------------------------------------------- /website/imgs/anaconda_nav_env_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/anaconda_nav_env_0.png -------------------------------------------------------------------------------- /website/imgs/anaconda_nav_env_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/anaconda_nav_env_1.png -------------------------------------------------------------------------------- /website/imgs/anaconda_navigator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/anaconda_navigator.png -------------------------------------------------------------------------------- /website/imgs/jupyter_in_vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/jupyter_in_vscode.png -------------------------------------------------------------------------------- /website/imgs/official_installer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/official_installer.png -------------------------------------------------------------------------------- /website/imgs/anaconda_navigator.png_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/anaconda_navigator.png_ -------------------------------------------------------------------------------- /website/imgs/fetch_name_and_clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/fetch_name_and_clone.png -------------------------------------------------------------------------------- /website/imgs/github_desktop_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/imgs/github_desktop_login.png -------------------------------------------------------------------------------- /website/_site/imgs/jupyter_in_vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/jupyter_in_vscode.png -------------------------------------------------------------------------------- /website/_site/imgs/anaconda_navigator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/imgs/anaconda_navigator.png -------------------------------------------------------------------------------- /website/modules/module-1/simple_script.py: -------------------------------------------------------------------------------- 1 | # Print a string object 2 | print("Bazinga") 3 | 4 | # Print the result of an algebraic operation 5 | print(2 + 4) 6 | -------------------------------------------------------------------------------- /env.yml: -------------------------------------------------------------------------------- 1 | name: ind216 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - python=3.13 6 | - numpy 7 | - pandas 8 | - matplotlib 9 | - jupyter 10 | -------------------------------------------------------------------------------- /website/docs/site_libs/bootstrap/bootstrap-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/docs/site_libs/bootstrap/bootstrap-icons.woff -------------------------------------------------------------------------------- /website/_site/site_libs/bootstrap/bootstrap-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoneSantoni/intro-to-Python-SMM692/HEAD/website/_site/site_libs/bootstrap/bootstrap-icons.woff -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "grammarly.selectors": [ 3 | { 4 | "language": "latex", 5 | "scheme": "file", 6 | "pattern": "notes/notes.tex" 7 | } 8 | ], 9 | "r.lsp.promptToInstall": false 10 | } -------------------------------------------------------------------------------- /notes/my_data: -------------------------------------------------------------------------------- 1 | 2 | # Below are some demographic data about Michael J. Jordan (basketball player) 3 | # from Wikipedia. 4 | # 5 | # Data labels are: 6 | # 7 | # NAME, BORN, NBA CHAMPIONSHIPS, AVERAGE POINT PER GAME 8 | "Jordan, Michael Jeffrey","17-02-1963",6,30.1 9 | -------------------------------------------------------------------------------- /notes/_minted-notes/B910E29F9AEAD48BB0C6192429850F9D764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{}} 3 | \PYG{k}{while} \PYG{n}{x} \PYG{o}{!=} \PYG{l+s+s2}{\PYGZdq{}\PYGZdq{}}\PYG{p}{:} 4 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} 5 | \PYG{n}{x} \PYG{o}{=} \PYG{n}{x}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{:]} 6 | \end{Verbatim} 7 | -------------------------------------------------------------------------------- /notes/_minted-notes/4BA959FC9F1D6EC5C0E4BE5CBBFEF515764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} Print a string object} 3 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Bazinga\PYGZdq{}}\PYG{p}{)} 4 | 5 | \PYG{c+c1}{\PYGZsh{} Print the result of an algebraic operation} 6 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+m+mi}{2} \PYG{o}{+} \PYG{l+m+mi}{4}\PYG{p}{)} 7 | \end{Verbatim} 8 | -------------------------------------------------------------------------------- /notes/_minted-notes/4BA959FC9F1D6EC5C0E4BE5CBBFEF515B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} Print a string object} 3 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Bazinga\PYGZdq{}}\PYG{p}{)} 4 | 5 | \PYG{c+c1}{\PYGZsh{} Print the result of an algebraic operation} 6 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+m+mi}{2} \PYG{o}{+} \PYG{l+m+mi}{4}\PYG{p}{)} 7 | \end{Verbatim} 8 | -------------------------------------------------------------------------------- /website/modules/module-4/index.qmd: -------------------------------------------------------------------------------- 1 | # Data Management with Pandas 2 | 3 | --- 4 | 5 | At the end of the chapter, you will be able to: 6 | 7 | - Create a DataFrame 8 | - Manipulate the individual columns of a DataFrame 9 | - Arrange a DataFrame in the way that best fits your data analysis needs 10 | - Group, the cases of DataFrame, to perform aggregation and transformation tasks 11 | - Work with multiple DataFrames 12 | - Read and write data in a variety of formats 13 | 14 | --- -------------------------------------------------------------------------------- /website/course/team.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Teaching team" 3 | --- 4 | 5 | 6 | 7 | :::: {.columns} 8 | 9 | ::: {.column width="50%"} 10 | ![](../imgs/sl.jpeg){width="300px"} 11 | 12 | ### Sangseok (Joseph) Lee 13 | **Instructor** 14 | 15 | Ph.D. student in strategy at the Bayes Business School 16 | 17 | 📬 [Sangseok.Lee@bayes.ac.uk](Sangseok.Lee@bayes.ac.uk) 18 | ::: 19 | 20 | ::: {.column width="50%"} 21 | ![](../imgs/ss.jpg){width="290px"} 22 | 23 | ### Simone Santoni 24 | **Module leader** 25 | 26 | Associate professor in strategy at the Bayes Business School 27 | 28 | 📬 [Simone.Santoni.1@city.ac.uk](Simone.Santoni.1@city.ac.uk) 29 | ::: 30 | 31 | :::: 32 | -------------------------------------------------------------------------------- /notes/_minted-notes/50DA700E56856207B8578FFAE39EF61F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 100} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{**} \PYG{l+m+mi}{100} 12 | \PYG{l+m+mi}{515377520732011331036461129765621272702107522001} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/50DA700E56856207B8578FFAE39EF61FB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 100} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{**} \PYG{l+m+mi}{100} 12 | \PYG{l+m+mi}{515377520732011331036461129765621272702107522001} 13 | 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/832FFA4A3FC6E953628C947A3EE992B1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the tuple} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T} \PYG{o}{=} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} 4 | 5 | \PYG{c+c1}{\PYGZsh{} access a tuple element} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 7 | \PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} access a tuple element} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} 11 | \PYG{l+m+mi}{3} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/0FEE1DB0482A67422C8836DCF236E9D1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} fi} 6 | 7 | \PYG{c+c1}{\PYGZsh{} the array} 8 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{)} 9 | 10 | \PYG{c+c1}{\PYGZsh{} random sampling from an existing array} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{random}\PYG{o}{.}\PYG{n}{choice}\PYG{p}{(}\PYG{n}{A}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/46CE52F14D83D9F4CA144B1AD458B74C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} an empty list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a list with an integer, a float, and a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{3.56}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}XyZ\PYGZdq{}}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} a list with an integer and a list} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 10 | \end{Verbatim} 11 | -------------------------------------------------------------------------------- /notes/_minted-notes/46CE52F14D83D9F4CA144B1AD458B74CB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} an empty list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a list with an integer, a float, and a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{3.56}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}XyZ\PYGZdq{}}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} a list with an integer and a list} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 10 | 11 | \end{Verbatim} 12 | -------------------------------------------------------------------------------- /notes/_minted-notes/8E7D3D59DECDC496828A28CF5B8BA78BB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} an empty list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a list with an integer, a float, and a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{3.56}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}XyZ\PYGZdq{}}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} a list with an integer and a list} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 10 | 11 | \end{Verbatim} 12 | -------------------------------------------------------------------------------- /notes/_minted-notes/2EDC601BD8BA9A6CC48DCCE9809F7026764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 100} 11 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mi}{3} \PYG{o}{**} \PYG{l+m+mi}{100} 12 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mi}{515377520732011331036461129765621272702107522001} 13 | 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/7026C1620E60A8E48355E59E72FAEF28764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 1000} 11 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mf}{1.2} \PYG{o}{+} \PYG{l+m+mf}{1.2}\PYG{n}{j} 12 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{p}{(}\PYG{l+m+mf}{1.2}\PYG{o}{+}\PYG{l+m+mf}{1.2}\PYG{n}{j}\PYG{p}{)} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/B06E57E23320B56BB43F698290A04840764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 1000} 11 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mf}{1.2} \PYG{o}{+} \PYG{l+m+mf}{1.2}\PYG{n}{j} 12 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{p}{(}\PYG{l+m+mf}{1.2}\PYG{o}{+}\PYG{l+m+mf}{1.2}\PYG{n}{j}\PYG{p}{)} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/3F680C2693DE03692D6A2B0A236EDB37764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create a list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get a set from L} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 8 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{\PYGZcb{}} 9 | \end{Verbatim} 10 | -------------------------------------------------------------------------------- /notes/_minted-notes/A35A6456F62A0A5D8BD1E5EB4F7FFD78764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} integer addition} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{1} \PYG{o}{+} \PYG{l+m+mi}{1} 4 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{2} 5 | 6 | \PYG{c+c1}{\PYGZsh{} floating-point multiplication} 7 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mi}{10} \PYG{o}{*} \PYG{l+m+mf}{0.5} 8 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mf}{5.0} 9 | 10 | \PYG{c+c1}{\PYGZsh{} 3 to the power 1000} 11 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mf}{1.2} \PYG{o}{+} \PYG{l+m+mf}{1.2}\PYG{n}{j} 12 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{p}{(}\PYG{l+m+mf}{1.2}\PYG{o}{+}\PYG{l+m+mf}{1.2}\PYG{n}{j}\PYG{p}{)} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/EB1BCEA24A3FB4E97B25667DEB68FB6A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} show the outcome of range} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{list}\PYG{p}{(}\PYG{n+nb}{range}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{))} 4 | \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} use range in a for loop} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n+nb}{range}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{):} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}:\PYGZhy{})\PYGZdq{}}\PYG{p}{)} 9 | \PYG{l+m+mi}{0} \PYG{p}{:}\PYG{o}{\PYGZhy{}}\PYG{p}{)} 10 | \PYG{l+m+mi}{1} \PYG{p}{:}\PYG{o}{\PYGZhy{}}\PYG{p}{)} 11 | \PYG{l+m+mi}{2} \PYG{p}{:}\PYG{o}{\PYGZhy{}}\PYG{p}{)} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/7422D78E46051525105100B3E707158F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} assign the variable 'a' to a floating-point number} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{a} \PYG{o}{=} \PYG{l+m+mf}{0.67544908755} 4 | 5 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first two decimals only} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.2f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 7 | \PYG{l+s+s2}{\PYGZdq{}0.68\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first three decimals only} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.3f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 11 | \PYG{l+s+s2}{\PYGZdq{}0.675\PYGZdq{}} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/7422D78E46051525105100B3E707158FB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} assign the variable 'a' to a floating-point number} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{a} \PYG{o}{=} \PYG{l+m+mf}{0.67544908755} 4 | 5 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first two decimals only} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.2f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 7 | \PYG{l+s+s2}{\PYGZdq{}0.68\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first three decimals only} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.3f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 11 | \PYG{l+s+s2}{\PYGZdq{}0.675\PYGZdq{}} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/6359399BA5B53D38F60488A7CCD99CFE764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the first item of L} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 7 | \PYG{l+m+mi}{4} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get the second element of L} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} 11 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]} 12 | 13 | \PYG{c+c1}{\PYGZsh{} get the first item of L's second item} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{][}\PYG{l+m+mi}{0}\PYG{p}{]} 15 | \PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/8D6739466FF81933615C9E5DADDAD73F764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the first item of L} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 7 | \PYG{l+m+mi}{4} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get the second element of L} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} 11 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]} 12 | 13 | \PYG{c+c1}{\PYGZsh{} get the first item of L's second item} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{][}\PYG{l+m+mi}{0}\PYG{p}{]} 15 | \PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/6359399BA5B53D38F60488A7CCD99CFEB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the first item of L} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 7 | \PYG{l+m+mi}{4} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get the second element of L} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} 11 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mf}{8.98}\PYG{p}{]} 12 | 13 | \PYG{c+c1}{\PYGZsh{} get the first item of L's second item} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{][}\PYG{l+m+mi}{0}\PYG{p}{]} 15 | \PYG{l+s+s2}{\PYGZdq{}abc\PYGZdq{}} 16 | 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/_minted-notes/D96A2987C6EB9036EF242D8F811649AD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a set with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x also bought Air Jordan 7 Retro Miro\PYGZdq{}}\PYG{p}{)} 8 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 9 | \PYG{o}{...} \PYG{k}{pass} 10 | \PYG{n}{Customers} \PYG{n}{who} \PYG{n}{bought} \PYG{n}{x} \PYG{n}{also} \PYG{n}{bought} \PYG{n}{Air} \PYG{n}{Jordan} \PYG{l+m+mi}{7} \PYG{n}{Retro} \PYG{n}{Miro} 11 | \end{Verbatim} 12 | -------------------------------------------------------------------------------- /notes/_minted-notes/C5FEA50408BF7DE712BC7545A5830BAC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} assign the variable 'a' to a floating-point number} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{n}{a} \PYG{o}{=} \PYG{l+m+mf}{0.67544908755} 4 | 5 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first two decimals only} 6 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.2f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 7 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+s+s2}{\PYGZdq{}0.68\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} displaying 'a' with the first three decimals only} 10 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}:.3f\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{a}\PYG{p}{)} 11 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+s+s2}{\PYGZdq{}0.675\PYGZdq{}} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /website/modules/module-3/index.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Technical & Scientific Computation with NumPy" 3 | --- 4 | 5 | At the end of this module, you will be able to: 6 | 7 | - Create efficient data structures called `ndarrays` 8 | - Populate `ndarrays` with simulated or real-world data 9 | - Manipulate `ndarrays` with a variety of scalable routines 10 | - Carry out exploratory data analysis with NumPy 11 | - Read and write `ndarrays` in many formats 12 | 13 | ## Module Content 14 | 15 | This module covers the following topics: 16 | 17 | 1. [Installing NumPy](installing-numpy.qmd) 18 | 2. [NumPy ndarray](numpy-ndarray.qmd) 19 | 3. [Array Creation Routines](array-creation-routines.qmd) 20 | 4. [Array Manipulation Routines](array-manipulation-routines.qmd) 21 | 5. [Universal Functions in NumPy](universal-functions.qmd) 22 | 6. [Mathematical Functions](mathematical-functions.qmd) 23 | 7. [Statistics](statistics.qmd) 24 | 8. [Linear Algebra](linear-algebra.qmd) 25 | 9. [Pseudorandom Number Generation](pseudorandom-number-generation.qmd) 26 | 10. [File Input and Output (IO) with ndarrays](file-io-with-ndarrays.qmd) -------------------------------------------------------------------------------- /website/modules/module-3/installing-numpy.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Installing NumPy" 3 | --- 4 | 5 | ::: {.callout-note} 6 | ## Question 7 | Does NumPy come with the official Python installation file? 8 | ::: 9 | 10 | ::: {.callout-tip} 11 | ## Answer 12 | No, it does not. You need to install it separately using the package manager `pip`. 13 | ::: 14 | 15 | ::: {.callout-note} 16 | ## Question 17 | I am an Anaconda user: do I need to install NumPy 'separately'? 18 | ::: 19 | 20 | ::: {.callout-tip} 21 | ## Answer 22 | No, you do not. NumPy is included in 'base,' the default environment of Anaconda. However, if you create a new environment, you need to install NumPy --- and all the other modules you need --- with the package manager `conda`. 23 | ::: 24 | 25 | ::: {.callout-note} 26 | ## Question 27 | How do I install NumPy? 28 | ::: 29 | 30 | ::: {.callout-tip} 31 | ## Answer 32 | The easiest way is using the command line. Anaconda users run `$ conda install numpy scipy`, whereas Python official release users run `$ pip install numpy scipy`. Anaconda users can also install the modules they need from within Anaconda-Navigator. 33 | ::: -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Simone Santoni 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /website/imgs/python-module-icon-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | IND216 19 | 20 | 21 | Intro to 22 | 23 | 24 | Python 25 | 26 | 27 | -------------------------------------------------------------------------------- /website/_site/imgs/python-module-icon-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | IND216 19 | 20 | 21 | Intro to 22 | 23 | 24 | Python 25 | 26 | 27 | -------------------------------------------------------------------------------- /website/imgs/python-module-icon-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | IND216 19 | 20 | 21 | Intro to 22 | 23 | 24 | Python 25 | 26 | 27 | -------------------------------------------------------------------------------- /website/_site/site_libs/bootstrap/imgs/python-module-icon-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | IND216 19 | 20 | 21 | Intro to 22 | 23 | 24 | Python 25 | 26 | 27 | -------------------------------------------------------------------------------- /notes/_minted-notes/06BD3D91D2D5B97927C7A9262973A042764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the data} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{DATA}\PYG{p}{)} 8 | \PYG{p}{[[}\PYG{l+m+mi}{1} \PYG{l+m+mi}{2}\PYG{p}{]} 9 | \PYG{p}{[}\PYG{l+m+mi}{3} \PYG{l+m+mi}{4}\PYG{p}{]]} 10 | 11 | \PYG{c+c1}{\PYGZsh{} get the number of dimensions} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA}\PYG{o}{.}\PYG{n}{ndim} 13 | \PYG{l+m+mi}{2} 14 | 15 | \PYG{c+c1}{\PYGZsh{} get the shape} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA}\PYG{o}{.}\PYG{n}{shape} 17 | \PYG{p}{(}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} 18 | \end{Verbatim} 19 | -------------------------------------------------------------------------------- /notes/_minted-notes/27B642D0B8B0E1D8D32730ADB59FABB9B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the data} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{DATA}\PYG{p}{)} 8 | \PYG{p}{[[}\PYG{l+m+mi}{1} \PYG{l+m+mi}{2}\PYG{p}{]} 9 | \PYG{p}{[}\PYG{l+m+mi}{3} \PYG{l+m+mi}{4}\PYG{p}{]]} 10 | 11 | \PYG{c+c1}{\PYGZsh{} get the number of dimensions} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA}\PYG{o}{.}\PYG{n}{ndim} 13 | \PYG{l+m+mi}{2} 14 | 15 | \PYG{c+c1}{\PYGZsh{} get the shape} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA}\PYG{o}{.}\PYG{n}{shape} 17 | \PYG{p}{(}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} 18 | \end{Verbatim} 19 | -------------------------------------------------------------------------------- /website/styles.css: -------------------------------------------------------------------------------- 1 | /* Custom styles for IND216 Python course */ 2 | 3 | .navbar-brand { 4 | font-weight: bold; 5 | } 6 | 7 | .code-block { 8 | background-color: #f8f9fa; 9 | border-left: 4px solid #007bff; 10 | padding: 1rem; 11 | margin: 1rem 0; 12 | } 13 | 14 | .exercise-box { 15 | background-color: #e7f3ff; 16 | border: 1px solid #b3d7ff; 17 | border-radius: 5px; 18 | padding: 1rem; 19 | margin: 1rem 0; 20 | } 21 | 22 | .exercise-box h3 { 23 | color: #0056b3; 24 | margin-top: 0; 25 | } 26 | 27 | .tip-box { 28 | background-color: #fff3cd; 29 | border: 1px solid #ffeaa7; 30 | border-radius: 5px; 31 | padding: 1rem; 32 | margin: 1rem 0; 33 | } 34 | 35 | .warning-box { 36 | background-color: #f8d7da; 37 | border: 1px solid #f5c6cb; 38 | border-radius: 5px; 39 | padding: 1rem; 40 | margin: 1rem 0; 41 | } 42 | 43 | /* Improve code readability */ 44 | pre { 45 | background-color: #f8f9fa; 46 | border: 1px solid #e9ecef; 47 | border-radius: 0.375rem; 48 | padding: 0.75rem; 49 | } 50 | 51 | /* Style inline code */ 52 | code { 53 | background-color: #f1f3f4; 54 | padding: 0.2em 0.4em; 55 | border-radius: 0.25rem; 56 | font-size: 0.875em; 57 | } -------------------------------------------------------------------------------- /notes/_minted-notes/26B748FF565D4068675B1B7D7E8BE165764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T} \PYG{o}{=} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} 3 | 4 | \PYG{c+c1}{\PYGZsh{} from a tuple to a list} 5 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{n+nb}{list}\PYG{p}{(}\PYG{n}{T}\PYG{p}{)} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 7 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} amend L's items} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} \PYG{o}{=} \PYG{l+m+mi}{4} 11 | 12 | \PYG{c+c1}{\PYGZsh{} get back to a tuple} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T} \PYG{o}{=} \PYG{n+nb}{tuple}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{T}\PYG{p}{)} 15 | \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{)} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/26B748FF565D4068675B1B7D7E8BE165B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T} \PYG{o}{=} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} 3 | 4 | \PYG{c+c1}{\PYGZsh{} from a tuple to a list} 5 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{n+nb}{list}\PYG{p}{(}\PYG{n}{T}\PYG{p}{)} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 7 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} amend L's items} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} \PYG{o}{=} \PYG{l+m+mi}{4} 11 | 12 | \PYG{c+c1}{\PYGZsh{} get back to a tuple} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{T} \PYG{o}{=} \PYG{n+nb}{tuple}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{T}\PYG{p}{)} 15 | \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{)} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /website/_site/site_libs/bootstrap/imgs/python-module-icon-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | IND216 19 | 20 | 21 | Intro to 22 | 23 | 24 | Python 25 | 26 | 27 | -------------------------------------------------------------------------------- /website/docs/styles.css: -------------------------------------------------------------------------------- 1 | /* Custom styles for IND216 Python course */ 2 | 3 | .navbar-brand { 4 | font-weight: bold; 5 | } 6 | 7 | .code-block { 8 | background-color: #f8f9fa; 9 | border-left: 4px solid #007bff; 10 | padding: 1rem; 11 | margin: 1rem 0; 12 | } 13 | 14 | .exercise-box { 15 | background-color: #e7f3ff; 16 | border: 1px solid #b3d7ff; 17 | border-radius: 5px; 18 | padding: 1rem; 19 | margin: 1rem 0; 20 | } 21 | 22 | .exercise-box h3 { 23 | color: #0056b3; 24 | margin-top: 0; 25 | } 26 | 27 | .tip-box { 28 | background-color: #fff3cd; 29 | border: 1px solid #ffeaa7; 30 | border-radius: 5px; 31 | padding: 1rem; 32 | margin: 1rem 0; 33 | } 34 | 35 | .warning-box { 36 | background-color: #f8d7da; 37 | border: 1px solid #f5c6cb; 38 | border-radius: 5px; 39 | padding: 1rem; 40 | margin: 1rem 0; 41 | } 42 | 43 | /* Improve code readability */ 44 | pre { 45 | background-color: #f8f9fa; 46 | border: 1px solid #e9ecef; 47 | border-radius: 0.375rem; 48 | padding: 0.75rem; 49 | } 50 | 51 | /* Style inline code */ 52 | code { 53 | background-color: #f1f3f4; 54 | padding: 0.2em 0.4em; 55 | border-radius: 0.25rem; 56 | font-size: 0.875em; 57 | } -------------------------------------------------------------------------------- /notes/_minted-notes/91D9D88AB44D89D91E45ACBC50CB296C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the system of equations} 6 | \PYG{c+c1}{\PYGZsh{} --+ left-hand side} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{a} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{13}\PYG{p}{]])} 8 | \PYG{c+c1}{\PYGZsh{} --+ right-hand side} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{b} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{2000}\PYG{p}{,} \PYG{l+m+mi}{3000}\PYG{p}{])} 10 | 11 | \PYG{c+c1}{\PYGZsh{} solve the system of equations} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{linalg}\PYG{o}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{n}{a}\PYG{p}{,} \PYG{n}{b}\PYG{p}{)} 13 | \PYG{n}{array}\PYG{p}{([}\PYG{l+m+mf}{526.31578947}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{52.63157895}\PYG{p}{])} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/91D9D88AB44D89D91E45ACBC50CB296CB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the system of equations} 6 | \PYG{c+c1}{\PYGZsh{} --+ left-hand side} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{a} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{13}\PYG{p}{]])} 8 | \PYG{c+c1}{\PYGZsh{} --+ right-hand side} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{b} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{2000}\PYG{p}{,} \PYG{l+m+mi}{3000}\PYG{p}{])} 10 | 11 | \PYG{c+c1}{\PYGZsh{} solve the system of equations} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{linalg}\PYG{o}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{n}{a}\PYG{p}{,} \PYG{n}{b}\PYG{p}{)} 13 | \PYG{n}{array}\PYG{p}{([}\PYG{l+m+mf}{526.31578947}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{52.63157895}\PYG{p}{])} 14 | 15 | \end{Verbatim} 16 | -------------------------------------------------------------------------------- /notes/_minted-notes/C010F00FC0E42B0602FD04CB97C4C966764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the named tuple function from the module collection} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{from} \PYG{n+nn}{collections} \PYG{k+kn}{import} \PYG{n}{namedtuple} 4 | 5 | \PYG{c+c1}{\PYGZsh{} create an ad hoc class object 'Rec' that fits our data structure} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{Rec} \PYG{o}{=} \PYG{n}{namedtuple}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Rec\PYGZdq{}}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}character\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}first\PYGZus{}appearance\PYGZdq{}}\PYG{p}{])} 7 | 8 | \PYG{c+c1}{\PYGZsh{} use the generated class "Rec"} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} \PYG{o}{=} \PYG{n}{Rec}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{1963}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} A named-tuple record} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} 13 | \PYG{n}{Rec}\PYG{p}{(}\PYG{n}{character}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{n}{first\PYGZus{}appearance}\PYG{o}{=}\PYG{l+m+mi}{1963}\PYG{p}{)} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/C010F00FC0E42B0602FD04CB97C4C966B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the named tuple function from the module collection} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{from} \PYG{n+nn}{collections} \PYG{k+kn}{import} \PYG{n}{namedtuple} 4 | 5 | \PYG{c+c1}{\PYGZsh{} create an ad hoc class object 'Rec' that fits our data structure} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{Rec} \PYG{o}{=} \PYG{n}{namedtuple}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Rec\PYGZdq{}}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}character\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}first\PYGZus{}appearance\PYGZdq{}}\PYG{p}{])} 7 | 8 | \PYG{c+c1}{\PYGZsh{} use the generated class "Rec"} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} \PYG{o}{=} \PYG{n}{Rec}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{1963}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} A named-tuple record} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} 13 | \PYG{n}{Rec}\PYG{p}{(}\PYG{n}{character}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{n}{first\PYGZus{}appearance}\PYG{o}{=}\PYG{l+m+mi}{1963}\PYG{p}{)} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/D41D8CD98F00B204E9800998ECF8427EB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the named tuple function from the module collection} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{from} \PYG{n+nn}{collections} \PYG{k+kn}{import} \PYG{n}{namedtuple} 4 | 5 | \PYG{c+c1}{\PYGZsh{} create an ad hoc class object 'Rec' that fits our data structure} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{Rec} \PYG{o}{=} \PYG{n}{namedtuple}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Rec\PYGZdq{}}\PYG{p}{,} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}character\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}first\PYGZus{}appearance\PYGZdq{}}\PYG{p}{])} 7 | 8 | \PYG{c+c1}{\PYGZsh{} use the generated class "Rec"} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} \PYG{o}{=} \PYG{n}{Rec}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{1963}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} A named-tuple record} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{IRONMAN} 13 | \PYG{n}{Rec}\PYG{p}{(}\PYG{n}{character}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{,} \PYG{n}{first\PYGZus{}appearance}\PYG{o}{=}\PYG{l+m+mi}{1963}\PYG{p}{)} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/B5ACEFC255B8C347ED43479B42697F2E764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} create one-to-one matches of items and do something with them} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i}\PYG{p}{,} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n+nb}{zip}\PYG{p}{(}\PYG{n}{LETTERS}\PYG{p}{,} \PYG{n}{COLORS}\PYG{p}{):} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{} \PYGZlt{}\PYGZhy{}\PYGZgt{} \PYGZdq{}}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} 9 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 10 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 11 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/B5ACEFC255B8C347ED43479B42697F2EB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} create one-to-one matches of items and do something with them} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i}\PYG{p}{,} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n+nb}{zip}\PYG{p}{(}\PYG{n}{LETTERS}\PYG{p}{,} \PYG{n}{COLORS}\PYG{p}{):} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{} \PYGZlt{}\PYGZhy{}\PYGZgt{} \PYGZdq{}}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} 9 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 10 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 11 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/D96A2987C6EB9036EF242D8F811649ADB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} create one-to-one matches of items and do something with them} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i}\PYG{p}{,} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n+nb}{zip}\PYG{p}{(}\PYG{n}{LETTERS}\PYG{p}{,} \PYG{n}{COLORS}\PYG{p}{):} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{} \PYGZlt{}\PYGZhy{}\PYGZgt{} \PYGZdq{}}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} 9 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 10 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 11 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 12 | \end{Verbatim} 13 | -------------------------------------------------------------------------------- /notes/_minted-notes/872ADDC5215F6893FBD1B486E3A513CC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Thor\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}Asgardian\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Vision\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}android\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Wanda Maximoff\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}human\PYGZdq{}}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the items of D} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{items} \PYG{o}{=} \PYG{n}{D}\PYG{o}{.}\PYG{n}{items}\PYG{p}{()} 7 | 8 | \PYG{c+c1}{\PYGZsh{} iterate over key-value pairs and do something with them} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{k}\PYG{p}{,} \PYG{n}{v} \PYG{o+ow}{in} \PYG{n}{items}\PYG{p}{:} 10 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{k} \PYG{o}{+} \PYG{l+s+s2}{\PYGZdq{} IS \PYGZdq{}} \PYG{o}{+} \PYG{n}{v}\PYG{p}{)} 11 | \PYG{n}{Thor} \PYG{n}{IS} \PYG{n}{Asgardian} 12 | \PYG{n}{Vision} \PYG{n}{IS} \PYG{n}{android} 13 | \PYG{n}{Wanda} \PYG{n}{Maximoff} \PYG{n}{IS} \PYG{n}{human} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/1F9F889A329993A23E484B930F0DF797764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the for loop way} 3 | \PYG{c+c1}{\PYGZsh{} --+ create an empty list} 4 | \PYG{n}{L} \PYG{o}{=} \PYG{p}{[]} 5 | \PYG{c+c1}{\PYGZsh{} --+ create a for loop appending the square of some items} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n+nb}{range}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{):} 7 | \PYG{o}{...} \PYG{n}{L}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{i} \PYG{o}{**} \PYG{l+m+mi}{2}\PYG{p}{)} 8 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 10 | \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]} 11 | 12 | \PYG{c+c1}{\PYGZsh{} the list comprehension way} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{n}{i} \PYG{o}{**} \PYG{l+m+mi}{2} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n+nb}{range}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{)]} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 15 | \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/693CD82CBEF067F12E39878ED8471163764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}}\PYG{p}{)} 4 | 5 | \PYG{c+c1}{\PYGZsh{} calling "file" yields the attributes of the file object} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} 7 | \PYG{o}{\PYGZlt{}}\PYG{n}{\PYGZus{}io}\PYG{o}{.}\PYG{n}{TextIOWrapper} \PYG{n}{name}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}} \PYG{n}{encoding}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}UTF\PYGZhy{}8\PYGZdq{}}\PYG{o}{\PYGZgt{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} let us source the data} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{data} \PYG{o}{=} \PYG{n}{file}\PYG{o}{.}\PYG{n}{read}\PYG{p}{()} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{data}\PYG{p}{)} 12 | \PYG{n}{Hi} \PYG{n}{there} 13 | 14 | \PYG{c+c1}{\PYGZsh{} close the pipe} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/693CD82CBEF067F12E39878ED8471163B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}}\PYG{p}{)} 4 | 5 | \PYG{c+c1}{\PYGZsh{} calling "file" yields the attributes of the file object} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} 7 | \PYG{o}{\PYGZlt{}}\PYG{n}{\PYGZus{}io}\PYG{o}{.}\PYG{n}{TextIOWrapper} \PYG{n}{name}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}} \PYG{n}{encoding}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}UTF\PYGZhy{}8\PYGZdq{}}\PYG{o}{\PYGZgt{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} let us source the data} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{data} \PYG{o}{=} \PYG{n}{file}\PYG{o}{.}\PYG{n}{read}\PYG{p}{()} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{data}\PYG{p}{)} 12 | \PYG{n}{Hi} \PYG{n}{there} 13 | 14 | \PYG{c+c1}{\PYGZsh{} close the pipe} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 16 | \end{Verbatim} 17 | -------------------------------------------------------------------------------- /notes/_minted-notes/A3CF788BDDE65300804B48B0EF48D5CD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a list with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x also bought Air Jordan 7 Retro Miro\PYGZdq{}}\PYG{p}{)} 8 | \PYG{o}{...} \PYG{k}{elif} \PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 9 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}How about Converse Chuck Taylor All Star?\PYGZdq{}}\PYG{p}{)} 10 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 11 | \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Falling short of suggestions \PYGZhy{}\PYGZhy{}\PYGZhy{} I\PYGZsq{}m a dull recommender!\PYGZdq{}}\PYG{p}{)} 12 | \PYG{n}{How} \PYG{n}{about} \PYG{n}{Converse} \PYG{n}{Chuck} \PYG{n}{Taylor} \PYG{n}{All} \PYG{n}{Star}\PYG{err}{?} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /website/docs/site_libs/quarto-html/tippy.css: -------------------------------------------------------------------------------- 1 | .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} -------------------------------------------------------------------------------- /website/_site/site_libs/quarto-html/tippy.css: -------------------------------------------------------------------------------- 1 | .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} -------------------------------------------------------------------------------- /notes/_minted-notes/9A0921ED6CBF467052DC954066B1D4B1764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get data from a function} 6 | \PYG{c+c1}{\PYGZsh{} --+ create a function} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{my\PYGZus{}function} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{x}\PYG{p}{,} \PYG{n}{y}\PYG{p}{:} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mf}{0.5} \PYG{o}{*} \PYG{n}{y} \PYG{o}{**} \PYG{l+m+mi}{2} 8 | \PYG{c+c1}{\PYGZsh{} --+ create an array from my_fuction for given coordinates} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{fromfunction}\PYG{p}{(}\PYG{n}{my\PYGZus{}function}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{),} \PYG{n}{dtype}\PYG{o}{=}\PYG{n+nb}{float}\PYG{p}{)} 10 | \PYG{n}{array}\PYG{p}{([[} \PYG{l+m+mf}{0.} \PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{2.} \PYG{p}{],} 11 | \PYG{p}{[} \PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{1.} \PYG{p}{],} 12 | \PYG{p}{[} \PYG{l+m+mf}{2.} \PYG{p}{,} \PYG{l+m+mf}{1.5}\PYG{p}{,} \PYG{l+m+mf}{0.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/D6F8B83836AC49D2EF7E7C99B596F8A4764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get data from a function} 6 | \PYG{c+c1}{\PYGZsh{} --+ create a function} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{my\PYGZus{}function} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{x}\PYG{p}{,} \PYG{n}{y}\PYG{p}{:} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mf}{0.5} \PYG{o}{*} \PYG{n}{y} \PYG{o}{**} \PYG{l+m+mi}{2} 8 | \PYG{c+c1}{\PYGZsh{} --+ create an array from my\_fuction for given coordinates} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{fromfunction}\PYG{p}{(}\PYG{n}{my\PYGZus{}function}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{),} \PYG{n}{dtype}\PYG{o}{=}\PYG{n+nb}{float}\PYG{p}{)} 10 | \PYG{n}{array}\PYG{p}{([[} \PYG{l+m+mf}{0.} \PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{2.} \PYG{p}{],} 11 | \PYG{p}{[} \PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{1.} \PYG{p}{],} 12 | \PYG{p}{[} \PYG{l+m+mf}{2.} \PYG{p}{,} \PYG{l+m+mf}{1.5}\PYG{p}{,} \PYG{l+m+mf}{0.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/3B7B739304A11ED4A4CDFBEE7DBEFB75764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} implementing a nested for loop with a list comprehension} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTER2COLOR} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}\PYGZcb{}}\PYG{l+s+s2}{ \PYGZlt{}\PYGZhy{}\PYGZgt{} }\PYG{l+s+si}{\PYGZob{}\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} \PYG{k}{for} \PYG{n}{i}\PYG{p}{,} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n+nb}{zip}\PYG{p}{(}\PYG{n}{LETTERS}\PYG{p}{,} \PYG{n}{COLORS}\PYG{p}{)]} 8 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}1 \PYGZlt{}\PYGZhy{}\PYGZgt{} blue\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}2 \PYGZlt{}\PYGZhy{}\PYGZgt{} green\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}3 \PYGZlt{}\PYGZhy{}\PYGZgt{} red\PYGZsq{}}\PYG{p}{]} 9 | \end{Verbatim} 10 | -------------------------------------------------------------------------------- /notes/_minted-notes/8DE09300C5C269322DFCCFA8E4CA8709764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get data from a function} 6 | \PYG{c+c1}{\PYGZsh{} --+ create a function} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{my\PYGZus{}function} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{x}\PYG{p}{,} \PYG{n}{y}\PYG{p}{:} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mf}{0.5} \PYG{o}{*} \PYG{n}{y} \PYG{o}{**} \PYG{l+m+mi}{2} 8 | \PYG{c+c1}{\PYGZsh{} --+ create an array from my\_fuction for given coordinates} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{fromfunction}\PYG{p}{(}\PYG{n}{my}\PYGZbs{}\PYG{n}{\PYGZus{}function}\PYG{p}{,} \PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{),} \PYG{n}{dtype}\PYG{o}{=}\PYG{n+nb}{float}\PYG{p}{)} 10 | \PYG{n}{array}\PYG{p}{([[} \PYG{l+m+mf}{0.} \PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{2.} \PYG{p}{],} 11 | \PYG{p}{[} \PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.5}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{1.} \PYG{p}{],} 12 | \PYG{p}{[} \PYG{l+m+mf}{2.} \PYG{p}{,} \PYG{l+m+mf}{1.5}\PYG{p}{,} \PYG{l+m+mf}{0.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/27B642D0B8B0E1D8D32730ADB59FABB9764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} loop until reaching a numeric threshold} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{i} \PYG{o}{=} \PYG{l+m+mi}{0} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{while} \PYG{n}{i} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{3}\PYG{p}{:} 5 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{)} 6 | \PYG{o}{...} \PYG{n}{i} \PYG{o}{=} \PYG{n}{i} \PYG{o}{+} \PYG{l+m+mi}{1} 7 | \PYG{l+m+mi}{0} 8 | \PYG{l+m+mi}{1} 9 | \PYG{l+m+mi}{2} 10 | \PYG{l+m+mi}{3} 11 | 12 | \PYG{c+c1}{\PYGZsh{} loop until an empty string is returned} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Indiana Jones\PYGZdq{}} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{while} \PYG{n}{x} \PYG{o}{!=} \PYG{l+s+s2}{\PYGZdq{}\PYGZdq{}}\PYG{p}{:} 15 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} 16 | \PYG{o}{...} \PYG{n}{x} \PYG{o}{=} \PYG{n}{x}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{:]} 17 | \PYG{o}{...} 18 | \PYG{n}{Indiana} \PYG{n}{Jones} 19 | \PYG{n}{ndiana} \PYG{n}{Jones} 20 | \PYG{n}{diana} \PYG{n}{Jones} 21 | \PYG{n}{iana} \PYG{n}{Jones} 22 | \PYG{n}{ana} \PYG{n}{Jones} 23 | \PYG{n}{na} \PYG{n}{Jones} 24 | \PYG{n}{a} \PYG{n}{Jones} 25 | \PYG{n}{Jones} 26 | \PYG{n}{Jones} 27 | \PYG{n}{ones} 28 | \PYG{n}{nes} 29 | \PYG{n}{es} 30 | \PYG{n}{s} 31 | \end{Verbatim} 32 | -------------------------------------------------------------------------------- /notes/_minted-notes/EDE8E363B921494EBA7F7D843B42DC8E764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | 3 | \PYG{c+c1}{\PYGZsh{} let us assign the variables 'x' and 'y' to two number objects} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{2} 5 | 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mf}{4.0} 7 | 8 | \PYG{c+c1}{\PYGZsh{} subtracting an integer from variable 'x'} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{1} 10 | \PYG{l+m+mi}{1} 11 | 12 | \PYG{c+c1}{\PYGZsh{} dividing the variable 'y' by an integer} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{/} \PYG{l+m+mi}{73} 14 | \PYG{l+m+mf}{0.0547945205479452} 15 | 16 | \PYG{c+c1}{\PYGZsh{} integer-dividing the variable 'y' by an integer} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{//} \PYG{l+m+mi}{73} 18 | \PYG{l+m+mf}{0.0} 19 | 20 | \PYG{c+c1}{\PYGZsh{} getting a linear combination of 'x' and 'y'} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 22 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{14.0} 23 | 24 | \PYG{c+c1}{\PYGZsh{} assigning the variable 'z' to the linear combination of 'x' and 'y'} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 26 | \end{Verbatim} 27 | -------------------------------------------------------------------------------- /notes/_minted-notes/6C4FE0567213F2340087B75669A155D3B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | 3 | \PYG{c+c1}{\PYGZsh{} let us assign the variables 'x' and 'y' to two number objects} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{2} 5 | 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mf}{4.0} 7 | 8 | \PYG{c+c1}{\PYGZsh{} subtracting an integer from variable 'x'} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{1} 10 | \PYG{l+m+mi}{1} 11 | 12 | \PYG{c+c1}{\PYGZsh{} dividing the variable 'y' by an integer} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{/} \PYG{l+m+mi}{73} 14 | \PYG{l+m+mf}{0.0547945205479452} 15 | 16 | \PYG{c+c1}{\PYGZsh{} integer-dividing the variable 'y' by an integer} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{//} \PYG{l+m+mi}{73} 18 | \PYG{l+m+mf}{0.0} 19 | 20 | \PYG{c+c1}{\PYGZsh{} getting a linear combination of 'x' and 'y'} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 22 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{14.0} 23 | 24 | \PYG{c+c1}{\PYGZsh{} assigning the variable 'z' to the linear combination of 'x' and 'y'} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 26 | 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/EDE8E363B921494EBA7F7D843B42DC8EB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | 3 | \PYG{c+c1}{\PYGZsh{} let us assign the variables 'x' and 'y' to two number objects} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{2} 5 | 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mf}{4.0} 7 | 8 | \PYG{c+c1}{\PYGZsh{} subtracting an integer from variable 'x'} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{1} 10 | \PYG{l+m+mi}{1} 11 | 12 | \PYG{c+c1}{\PYGZsh{} dividing the variable 'y' by an integer} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{/} \PYG{l+m+mi}{73} 14 | \PYG{l+m+mf}{0.0547945205479452} 15 | 16 | \PYG{c+c1}{\PYGZsh{} integer-dividing the variable 'y' by an integer} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{//} \PYG{l+m+mi}{73} 18 | \PYG{l+m+mf}{0.0} 19 | 20 | \PYG{c+c1}{\PYGZsh{} getting a linear combination of 'x' and 'y'} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 22 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{14.0} 23 | 24 | \PYG{c+c1}{\PYGZsh{} assigning the variable 'z' to the linear combination of 'x' and 'y'} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 26 | 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/82837FE20863933F1E2DDF8F5B6F3121764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create a list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} reverse the list's item positions} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{o}{.}\PYG{n}{reverse}\PYG{p}{()} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 8 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{]} 9 | 10 | \PYG{c+c1}{\PYGZsh{} sort the list's items} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{o}{.}\PYG{n}{sort}\PYG{p}{()} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 13 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{]} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/82837FE20863933F1E2DDF8F5B6F3121B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create a list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} reverse the list's item positions} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{o}{.}\PYG{n}{reverse}\PYG{p}{()} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 8 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{]} 9 | 10 | \PYG{c+c1}{\PYGZsh{} sort the list's items} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{o}{.}\PYG{n}{sort}\PYG{p}{()} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 13 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{]} 14 | 15 | \end{Verbatim} 16 | -------------------------------------------------------------------------------- /notes/_minted-notes/2CF761A7A0EC9D31984A9B71ECC3ECFC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a list with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} a also bought Air Force\PYGZdq{}}\PYG{p}{)} 9 | \PYG{o}{...} \PYG{k}{elif} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 10 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} u also bought Air Max 95\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 12 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Falling short of suggestions \PYGZhy{}\PYGZhy{}\PYGZhy{} I\PYGZsq{}m a dull recommender!\PYGZdq{}}\PYG{p}{)} 13 | \PYG{n}{Customers} \PYG{n}{who} \PYG{n}{bought} \PYG{n}{x} \PYG{o}{\PYGZam{}} \PYG{n}{a} \PYG{n}{also} \PYG{n}{bought} \PYG{n}{Air} \PYG{n}{Force} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/2CF761A7A0EC9D31984A9B71ECC3ECFCB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a list with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} a also bought Air Force\PYGZdq{}}\PYG{p}{)} 9 | \PYG{o}{...} \PYG{k}{elif} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 10 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} u also bought Air Max 95\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 12 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Falling short of suggestions \PYGZhy{}\PYGZhy{}\PYGZhy{} I\PYGZsq{}m a dull recommender!\PYGZdq{}}\PYG{p}{)} 13 | \PYG{n}{Customers} \PYG{n}{who} \PYG{n}{bought} \PYG{n}{x} \PYG{o}{\PYGZam{}} \PYG{n}{a} \PYG{n}{also} \PYG{n}{bought} \PYG{n}{Air} \PYG{n}{Force} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/4D06FA9D4193AC53EAB0288005BCBBF2B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a list with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} a also bought Air Force\PYGZdq{}}\PYG{p}{)} 9 | \PYG{o}{...} \PYG{k}{elif} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 10 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} u also bought Air Max 95\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 12 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Falling short of suggestions \PYGZhy{}\PYGZhy{}\PYGZhy{} I\PYGZsq{}m a dull recommender!\PYGZdq{}}\PYG{p}{)} 13 | \PYG{n}{Customers} \PYG{n}{who} \PYG{n}{bought} \PYG{n}{x} \PYG{o}{\PYGZam{}} \PYG{n}{a} \PYG{n}{also} \PYG{n}{bought} \PYG{n}{Air} \PYG{n}{Force} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/A4AE5492CB42844DAD7B13205B950062B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} a list with a customer's past purchases} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{])} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a rule-based product recommender} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 7 | \PYG{o}{...} \PYG{k}{if} \PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} a also bought Air Force\PYGZdq{}}\PYG{p}{)} 9 | \PYG{o}{...} \PYG{k}{elif} \PYG{l+s+s2}{\PYGZdq{}u\PYGZdq{}} \PYG{o+ow}{in} \PYG{n}{S}\PYG{p}{:} 10 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Customers who bought x \PYGZam{} u also bought Air Max 95\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 12 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Falling short of suggestions \PYGZhy{}\PYGZhy{}\PYGZhy{} I\PYGZsq{}m a dull recommender!\PYGZdq{}}\PYG{p}{)} 13 | \PYG{n}{Customers} \PYG{n}{who} \PYG{n}{bought} \PYG{n}{x} \PYG{o}{\PYGZam{}} \PYG{n}{a} \PYG{n}{also} \PYG{n}{bought} \PYG{n}{Air} \PYG{n}{Force} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/1A96ECB8032A91326FEBEAB60961966D764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign S to a string object} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Both Python 3.X and Julia have outstanding ML modules\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} strip target leading characters} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{lstrip}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Both \PYGZdq{}}\PYG{p}{)} 7 | \PYG{l+s+s2}{\PYGZdq{}Python 3.X and Julia have outstanding ML modules\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} replace target characters} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{replace}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Python 3.X\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}R\PYGZdq{}}\PYG{p}{)} 11 | \PYG{l+s+s2}{\PYGZdq{}Both R and Julia have outstanding ML modules\PYGZdq{}} 12 | 13 | \PYG{c+c1}{\PYGZsh{} split string on target characters} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{split}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{} and \PYGZdq{}}\PYG{p}{)} 15 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Both Python 3.X\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Julia have outstanding ML modules\PYGZdq{}}\PYG{p}{]} 16 | 17 | \PYG{c+c1}{\PYGZsh{} make the string lower case} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{lower}\PYG{p}{()} 19 | \PYG{l+s+s2}{\PYGZdq{}both python 3.x and julia have outstanding ml modules\PYGZdq{}} 20 | \end{Verbatim} 21 | -------------------------------------------------------------------------------- /notes/_minted-notes/1A96ECB8032A91326FEBEAB60961966DB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign S to a string object} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Both Python 3.X and Julia have outstanding ML modules\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} strip target leading characters} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{lstrip}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Both \PYGZdq{}}\PYG{p}{)} 7 | \PYG{l+s+s2}{\PYGZdq{}Python 3.X and Julia have outstanding ML modules\PYGZdq{}} 8 | 9 | \PYG{c+c1}{\PYGZsh{} replace target characters} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{replace}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Python 3.X\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}R\PYGZdq{}}\PYG{p}{)} 11 | \PYG{l+s+s2}{\PYGZdq{}Both R and Julia have outstanding ML modules\PYGZdq{}} 12 | 13 | \PYG{c+c1}{\PYGZsh{} split string on target characters} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{split}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{} and \PYGZdq{}}\PYG{p}{)} 15 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Both Python 3.X\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Julia have outstanding ML modules\PYGZdq{}}\PYG{p}{]} 16 | 17 | \PYG{c+c1}{\PYGZsh{} make the string lower case} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{lower}\PYG{p}{()} 19 | \PYG{l+s+s2}{\PYGZdq{}both python 3.x and julia have outstanding ml modules\PYGZdq{}} 20 | \end{Verbatim} 21 | -------------------------------------------------------------------------------- /notes/_minted-notes/515895B1D8C40802B4ABEB29B92AECE8764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} method 1} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} method 2} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{CHARACTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{]} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{RANK} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{]} 8 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{n+nb}{dict}\PYG{p}{(}\PYG{n+nb}{zip}\PYG{p}{(}\PYG{n}{CHARACTERS}\PYG{p}{,} \PYG{n}{RANK}\PYG{p}{))} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{D}\PYG{p}{)} 10 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 11 | \end{Verbatim} 12 | -------------------------------------------------------------------------------- /notes/_minted-notes/2412612A10D149EBD64F4851B8398DBC764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import records array with an alias that does not conflict with} 3 | \PYG{c+c1}{\PYGZsh{} `standard' NumPy arrays} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{from} \PYG{n+nn}{numpy.core.records} \PYG{k+kn}{import} \PYG{n}{array} \PYG{k}{as} \PYG{n}{recarray} 5 | 6 | \PYG{c+c1}{\PYGZsh{} the data} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LOCS} \PYG{o}{=} \PYG{p}{[(}\PYG{l+s+s2}{\PYGZdq{}51.5072° N\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}0.1276° W\PYGZdq{}}\PYG{p}{),} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}35.6762° N\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}139.6503° E\PYGZdq{}}\PYG{p}{)]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} create a recarray} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{n}{recarray}\PYG{p}{(}\PYG{n}{LOCS}\PYG{p}{,} \PYG{n}{formats}\PYG{o}{=}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}U12\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}U12\PYGZdq{}}\PYG{p}{],} \PYG{n}{names}\PYG{o}{=}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Latitude\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Longitude\PYGZdq{}}\PYG{p}{])} 11 | 12 | \PYG{c+c1}{\PYGZsh{} fetch the data by field name} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{Latitude} 14 | \PYG{n}{array}\PYG{p}{([}\PYG{l+s+s1}{\PYGZsq{}51.5072° N\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}35.6762° N\PYGZsq{}}\PYG{p}{],} \PYG{n}{dtype}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}\PYGZlt{}U12\PYGZsq{}}\PYG{p}{)} 15 | \end{Verbatim} 16 | -------------------------------------------------------------------------------- /notes/_minted-notes/3669482A35653C3123AD335BC5937445B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} print the result of a mathematical operation carried out over a list of items} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{99}\PYG{p}{,} \PYG{l+m+mi}{13}\PYG{p}{,} \PYG{l+m+mf}{6.54}\PYG{p}{]:} 4 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{item} \PYG{o}{**} \PYG{l+m+mf}{0.5}\PYG{p}{)} 5 | \PYG{l+m+mf}{0.0} 6 | \PYG{p}{(}\PYG{l+m+mf}{6.092540900222253e\PYGZhy{}16}\PYG{o}{+}\PYG{l+m+mi}{99498743710662}\PYG{n}{j}\PYG{p}{)} 7 | \PYG{l+m+mi}{3605551275463989} 8 | \PYG{l+m+mf}{2.5573423705088842} 9 | \PYG{c+c1}{\PYGZsh{} run a mathematical operation on a list of items and append the outcome} 10 | \PYG{c+c1}{\PYGZsh{} to a second list} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{input} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{output} \PYG{o}{=} \PYG{p}{[]} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{n+nb}{input}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{output}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{item} \PYG{o}{+} \PYG{l+m+mi}{1}\PYG{p}{)} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{output}\PYG{p}{)} 16 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/_minted-notes/6F4095632B64C1C9C7D76FB5A0673106764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} print the result of a mathematical operation carried out over a list of items} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{99}\PYG{p}{,} \PYG{l+m+mi}{13}\PYG{p}{,} \PYG{l+m+mf}{6.54}\PYG{p}{]:} 4 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{item} \PYG{o}{**} \PYG{l+m+mf}{0.5}\PYG{p}{)} 5 | \PYG{l+m+mf}{0.0} 6 | \PYG{p}{(}\PYG{l+m+mf}{6.092540900222253e\PYGZhy{}16}\PYG{o}{+}\PYG{l+m+mi}{99498743710662}\PYG{n}{j}\PYG{p}{)} 7 | \PYG{l+m+mi}{3605551275463989} 8 | \PYG{l+m+mf}{2.5573423705088842} 9 | \PYG{c+c1}{\PYGZsh{} run a mathematical operation on a list of items and append the outcome} 10 | \PYG{c+c1}{\PYGZsh{} to a second list} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{input} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{output} \PYG{o}{=} \PYG{p}{[]} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{n+nb}{input}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{output}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{item} \PYG{o}{+} \PYG{l+m+mi}{1}\PYG{p}{)} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{output}\PYG{p}{)} 16 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/_minted-notes/6F4095632B64C1C9C7D76FB5A0673106B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} print the result of a mathematical operation carried out over a list of items} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{99}\PYG{p}{,} \PYG{l+m+mi}{13}\PYG{p}{,} \PYG{l+m+mf}{6.54}\PYG{p}{]:} 4 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{item} \PYG{o}{**} \PYG{l+m+mf}{0.5}\PYG{p}{)} 5 | \PYG{l+m+mf}{0.0} 6 | \PYG{p}{(}\PYG{l+m+mf}{6.092540900222253e\PYGZhy{}16}\PYG{o}{+}\PYG{l+m+mi}{99498743710662}\PYG{n}{j}\PYG{p}{)} 7 | \PYG{l+m+mi}{3605551275463989} 8 | \PYG{l+m+mf}{2.5573423705088842} 9 | \PYG{c+c1}{\PYGZsh{} run a mathematical operation on a list of items and append the outcome} 10 | \PYG{c+c1}{\PYGZsh{} to a second list} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{input} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{output} \PYG{o}{=} \PYG{p}{[]} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{item} \PYG{o+ow}{in} \PYG{n+nb}{input}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{output}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{item} \PYG{o}{+} \PYG{l+m+mi}{1}\PYG{p}{)} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{output}\PYG{p}{)} 16 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/notes.listing: -------------------------------------------------------------------------------- 1 | # import pandas with the socially accepted alias pd 2 | >>> import pandas as pd 3 | 4 | # the data frames 5 | >>> df0 = pd.DataFrame.from_dict( 6 | {"product": [1, 2, 3], "sales": [10, 30, 20]} 7 | ) 8 | >>> df1 = pd.DataFrame.from_dict( 9 | {"product": [2, 3, 4], "margin": [0.13, 0.31, 0.21]} 10 | ) 11 | 12 | # merge the data frames 13 | # --+ keep all the cases from the left data frame 14 | >>> pd.merge(df0, df1, on="propduct", how="left") 15 | product sales margin 16 | 0 1 10 NaN 17 | 1 2 30 0.13 18 | 2 3 20 0.31 19 | # --+ keep all the cases from the right data frame 20 | >>> pd.merge(df0, df1, on="propduct", how="right") 21 | product sales margin 22 | 0 2 30.0 0.13 23 | 1 3 20.0 0.31 24 | 2 4 NaN 0.21 25 | # --+ keep all cases 26 | >>> pd.merge(df0, df1, on="propduct", how="outer") 27 | product sales margin 28 | 0 1 10.0 NaN 29 | 1 2 30.0 0.13 30 | 2 3 20.0 0.31 31 | 3 4 NaN 0.21 32 | # --+ keep the cases that are present in both data frames 33 | >>> pd.merge(df0, df1, on="propduct", how="inner") 34 | product sales margin 35 | 0 2 30 0.13 36 | 1 3 20 0.31 37 | # ---+ merge using the indices 38 | # ----+ set the indices 39 | >>> df0.set_index("product", inplace=True) 40 | >>> df1.set_index("product", inplace=True) 41 | # ----+ merge the data frames 42 | >>> pd.merge(df0, df1, left_index=True, right_index=True) 43 | sales margin 44 | product 45 | 2 30 0.13 46 | 3 20 0.31 47 | -------------------------------------------------------------------------------- /notes/_minted-notes/72E7C98E513837B5FA723ADEA03DAB19764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Thor\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}Asgardian\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Vision\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}android\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Wanda Maximoff\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}human\PYGZdq{}}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the keys of D} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{keys} \PYG{o}{=} \PYG{n}{D}\PYG{o}{.}\PYG{n}{keys}\PYG{p}{()} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{keys}\PYG{p}{)} 8 | \PYG{n}{dict\PYGZus{}keys}\PYG{p}{([}\PYG{l+s+s1}{\PYGZsq{}Thor\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}Vision\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}Wanda Maximoff\PYGZsq{}}\PYG{p}{])} 9 | 10 | \PYG{c+c1}{\PYGZsh{} iterate over the keys to fetch the dictionary values and do something} 11 | \PYG{c+c1}{\PYGZsh{} with them} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{k} \PYG{o+ow}{in} \PYG{n}{keys}\PYG{p}{:} 13 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{k} \PYG{o}{+} \PYG{l+s+s2}{\PYGZdq{} IS \PYGZdq{}} \PYG{o}{+} \PYG{n}{D}\PYG{p}{[}\PYG{n}{k}\PYG{p}{])} 14 | \PYG{n}{Thor} \PYG{n}{IS} \PYG{n}{Asgardian} 15 | \PYG{n}{Vision} \PYG{n}{IS} \PYG{n}{android} 16 | \PYG{n}{Wanda} \PYG{n}{Maximoff} \PYG{n}{IS} \PYG{n}{human} 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/_minted-notes/A32FDE08938F9AF90BAC21ECE523C061764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} less than} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{\PYGZlt{}} \PYG{l+m+mi}{2} 4 | \PYG{k+kc}{False} 5 | 6 | \PYG{c+c1}{\PYGZsh{} greater than or equal} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{2} 8 | \PYG{k+kc}{True} 9 | 10 | \PYG{c+c1}{\PYGZsh{} equal} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{2} \PYG{o}{==} \PYG{l+m+mi}{2} 12 | \PYG{k+kc}{True} 13 | 14 | \PYG{c+c1}{\PYGZsh{} not equal} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{4} \PYG{o}{!=} \PYG{l+m+mi}{4} 16 | \PYG{k+kc}{False} 17 | 18 | \PYG{c+c1}{\PYGZsh{} range test} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{3} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mi}{5} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{4} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 23 | \PYG{k+kc}{False} 24 | 25 | \PYG{c+c1}{\PYGZsh{} joined test} 26 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{and} \PYG{n}{y} \PYG{o}{\PYGZgt{}} \PYG{n}{z} 27 | \PYG{k+kc}{True} 28 | 29 | \PYG{c+c1}{\PYGZsh{} disjoined test} 30 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{or} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 31 | \PYG{k+kc}{True} 32 | \end{Verbatim} 33 | -------------------------------------------------------------------------------- /website/theme-switcher.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notes/_minted-notes/13ACDD6E77E86DB548E01BB8E6686AADB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} less than} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{\PYGZlt{}} \PYG{l+m+mi}{2} 4 | \PYG{k+kc}{False} 5 | 6 | \PYG{c+c1}{\PYGZsh{} greater than or equal} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{2} 8 | \PYG{k+kc}{True} 9 | 10 | \PYG{c+c1}{\PYGZsh{} equal} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{2} \PYG{o}{==} \PYG{l+m+mi}{2} 12 | \PYG{k+kc}{True} 13 | 14 | \PYG{c+c1}{\PYGZsh{} not equal} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{4} \PYG{o}{!=} \PYG{l+m+mi}{4} 16 | \PYG{k+kc}{False} 17 | 18 | \PYG{c+c1}{\PYGZsh{} range test} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{3} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mi}{5} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{4} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 23 | \PYG{k+kc}{False} 24 | 25 | \PYG{c+c1}{\PYGZsh{} joined test} 26 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{and} \PYG{n}{y} \PYG{o}{\PYGZgt{}} \PYG{n}{z} 27 | \PYG{k+kc}{True} 28 | 29 | \PYG{c+c1}{\PYGZsh{} disjoined test} 30 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{or} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 31 | \PYG{k+kc}{True} 32 | 33 | \end{Verbatim} 34 | -------------------------------------------------------------------------------- /notes/_minted-notes/815D703D9A02BE8170DDD725F121D741764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import pandas with the socially acceptable alias pd} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a timestamp as a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{s} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}2011\PYGZhy{}11\PYGZhy{}01 23:17:01\PYGZdq{}} 7 | 8 | \PYG{c+c1}{\PYGZsh{} get a period object} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Period}\PYG{p}{(}\PYG{n}{s}\PYG{p}{,} \PYG{n}{freq}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}s\PYGZdq{}}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} extract sample information from p} 12 | \PYG{c+c1}{\PYGZsh{} --+ calendar day} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{day} 14 | \PYG{l+m+mi}{1} 15 | 16 | \PYG{c+c1}{\PYGZsh{} --+ day of the week (Monday is 0)} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{dayofweek} 18 | \PYG{l+m+mi}{1} 19 | 20 | \PYG{c+c1}{\PYGZsh{} --+ month} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{month} 22 | \PYG{l+m+mi}{11} 23 | 24 | \PYG{c+c1}{\PYGZsh{} --+ quarter} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{quarter} 26 | \PYG{l+m+mi}{4} 27 | 28 | \PYG{c+c1}{\PYGZsh{} --+ week of the year (ranging from 0 to 59)} 29 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{weekofyear} 30 | \PYG{l+m+mi}{4} 31 | \end{Verbatim} 32 | -------------------------------------------------------------------------------- /notes/_minted-notes/A32FDE08938F9AF90BAC21ECE523C061B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} less than} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{\PYGZlt{}} \PYG{l+m+mi}{2} 4 | \PYG{k+kc}{False} 5 | 6 | \PYG{c+c1}{\PYGZsh{} greater than or equal} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{2} 8 | \PYG{k+kc}{True} 9 | 10 | \PYG{c+c1}{\PYGZsh{} equal} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{2} \PYG{o}{==} \PYG{l+m+mi}{2} 12 | \PYG{k+kc}{True} 13 | 14 | \PYG{c+c1}{\PYGZsh{} not equal} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{4} \PYG{o}{!=} \PYG{l+m+mi}{4} 16 | \PYG{k+kc}{False} 17 | 18 | \PYG{c+c1}{\PYGZsh{} range test} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{3} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mi}{5} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{4} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 23 | \PYG{k+kc}{False} 24 | 25 | \PYG{c+c1}{\PYGZsh{} joined test} 26 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{and} \PYG{n}{y} \PYG{o}{\PYGZgt{}} \PYG{n}{z} 27 | \PYG{k+kc}{True} 28 | 29 | \PYG{c+c1}{\PYGZsh{} disjoined test} 30 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{or} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 31 | \PYG{k+kc}{True} 32 | 33 | \end{Verbatim} 34 | -------------------------------------------------------------------------------- /notes/_minted-notes/C242DD3276A444CA35DF51DE6CE64CCCB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} less than} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{3} \PYG{o}{\PYGZlt{}} \PYG{l+m+mi}{2} 4 | \PYG{k+kc}{False} 5 | 6 | \PYG{c+c1}{\PYGZsh{} greater than or equal} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{1} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{2} 8 | \PYG{k+kc}{True} 9 | 10 | \PYG{c+c1}{\PYGZsh{} equal} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{2} \PYG{o}{==} \PYG{l+m+mi}{2} 12 | \PYG{k+kc}{True} 13 | 14 | \PYG{c+c1}{\PYGZsh{} not equal} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{l+m+mi}{4} \PYG{o}{!=} \PYG{l+m+mi}{4} 16 | \PYG{k+kc}{False} 17 | 18 | \PYG{c+c1}{\PYGZsh{} range test} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{3} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mi}{5} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{4} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 23 | \PYG{k+kc}{False} 24 | 25 | \PYG{c+c1}{\PYGZsh{} joined test} 26 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{and} \PYG{n}{y} \PYG{o}{\PYGZgt{}} \PYG{n}{z} 27 | \PYG{k+kc}{True} 28 | 29 | \PYG{c+c1}{\PYGZsh{} disjoined test} 30 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{or} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 31 | \PYG{k+kc}{True} 32 | 33 | \end{Verbatim} 34 | -------------------------------------------------------------------------------- /website/modules/module-2/sets.qmd: -------------------------------------------------------------------------------- 1 | # Sets 2 | 3 | ::: {.callout-note} 4 | ## What is a set? 5 | 6 | A [`set`](https://docs.python.org/3/tutorial/datastructures.html#sets) is an *unordered* collection of *unique* and *immutable* objects. 7 | ::: 8 | 9 | ::: {.callout-note} 10 | ## What does it mean that sets are unordered collections? 11 | 12 | By design, [`set`](https://docs.python.org/3/tutorial/datastructures.html#sets) is a data structure with *undefined element ordering* (see Snippet 4.22 --- the outcome included in line 6 does not follow any particular order). 13 | ::: 14 | 15 | ::: {.callout-note} 16 | ## What does it mean that sets have unique items? 17 | 18 | By definition, an item appears only once in a set, no matter how many times it is added (see Snippet 4.22, line 2 Vs. line 7). 19 | ::: 20 | 21 | ```python 22 | # create a list 23 | >>> L = ["a", "a", "b", "c", "c"] 24 | 25 | # get a set from L 26 | >>> S = set(L) 27 | >>> print(S) 28 | {"b", "a", "c"} 29 | ``` 30 | 31 | ::: {.callout-note} 32 | ## Why should I use sets? 33 | 34 | Sets made this way support common mathematical set operations (see Snippet 4.23). Hence, they have a variety of applications, especially in numeric and database-focused work. 35 | ::: 36 | 37 | ```python 38 | # create two sets 39 | >>> X = set(["a", "b", "c"]) 40 | >>> Y = set(["c", "d", "e"]) 41 | 42 | # set difference 43 | >>> X - X 44 | set() 45 | >>> X - Y 46 | {"a", "b"} 47 | 48 | # union 49 | >>> X | Y 50 | {"a", "b", "c", "d", "e"} 51 | 52 | # intersection 53 | >>> X & Y 54 | {"c"} 55 | 56 | # superset 57 | >>> X > Y 58 | False 59 | 60 | # subset 61 | >>> X < Y 62 | False 63 | ``` -------------------------------------------------------------------------------- /notes/_minted-notes/219B793E758A81220EF9F461F9684F95B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import pandas with the socially acceptable alias pd} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a timestamp as a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{s} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}2011\PYGZhy{}11\PYGZhy{}01 23:17:01\PYGZdq{}} 7 | 8 | \PYG{c+c1}{\PYGZsh{} get a period object} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Period}\PYG{p}{(}\PYG{n}{s}\PYG{p}{,} \PYG{n}{freq}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}s\PYGZdq{}}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} extract sample information from p} 12 | \PYG{c+c1}{\PYGZsh{} --+ calendar day} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{day} 14 | \PYG{l+m+mi}{1} 15 | 16 | \PYG{c+c1}{\PYGZsh{} --+ day of the week (Monday is 0)} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{dayofweek} 18 | \PYG{l+m+mi}{1} 19 | 20 | \PYG{c+c1}{\PYGZsh{} --+ month} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{month} 22 | \PYG{l+m+mi}{11} 23 | 24 | \PYG{c+c1}{\PYGZsh{} --+ quarter} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{quarter} 26 | \PYG{l+m+mi}{4} 27 | 28 | \PYG{c+c1}{\PYGZsh{} --+ week of the year (ranging from 0 to 59)} 29 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{weekofyear} 30 | \PYG{l+m+mi}{4} 31 | 32 | \end{Verbatim} 33 | -------------------------------------------------------------------------------- /notes/_minted-notes/815D703D9A02BE8170DDD725F121D741B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import pandas with the socially acceptable alias pd} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a timestamp as a string} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{s} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}2011\PYGZhy{}11\PYGZhy{}01 23:17:01\PYGZdq{}} 7 | 8 | \PYG{c+c1}{\PYGZsh{} get a period object} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Period}\PYG{p}{(}\PYG{n}{s}\PYG{p}{,} \PYG{n}{freq}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}s\PYGZdq{}}\PYG{p}{)} 10 | 11 | \PYG{c+c1}{\PYGZsh{} extract sample information from p} 12 | \PYG{c+c1}{\PYGZsh{} --+ calendar day} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{day} 14 | \PYG{l+m+mi}{1} 15 | 16 | \PYG{c+c1}{\PYGZsh{} --+ day of the week (Monday is 0)} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{dayofweek} 18 | \PYG{l+m+mi}{1} 19 | 20 | \PYG{c+c1}{\PYGZsh{} --+ month} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{month} 22 | \PYG{l+m+mi}{11} 23 | 24 | \PYG{c+c1}{\PYGZsh{} --+ quarter} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{quarter} 26 | \PYG{l+m+mi}{4} 27 | 28 | \PYG{c+c1}{\PYGZsh{} --+ week of the year (ranging from 0 to 59)} 29 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{p}\PYG{o}{.}\PYG{n}{weekofyear} 30 | \PYG{l+m+mi}{4} 31 | 32 | \end{Verbatim} 33 | -------------------------------------------------------------------------------- /website/course/schedule.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Course Schedule" 3 | --- 4 | 5 | | Module | Date | Topics | 6 | | -- | -- | -- | 7 | | Getting started with Python | 09-22 (stream A), 09-23 (stream B) | Installing Python - how to run Python programs - managing Python environments | 8 | | Python language fundamentals | 09-24 (stream A), 09-24 (stream B) | Object types - list - dictionaries - tuples - sets - files | 9 | | ... | 09-25 (stream A), 09-29 (stream B) | Statements - control flows - while and for loops - iterations and comprhensions | 10 | | Computing with NumPy | 10-1 (stream A), 10-2 (stream B) | Array creation - manipulation - functions - statistics - linear algebra - generators | 11 | | Pandas for data analysis | 10-2 (stream A), 10-6 (stream B) | Dataframes - querying - manipulation - 'time' data | 12 | | ... | 10-8 (stream A), 10-8 (stream B) | Grouping - working with multiple dataframes - IO | 13 | 14 | ::: {.callout-note} 15 | ## Adjustments and Updates 16 | 17 | This schedule is subject to change based on: 18 | 19 | - Class progress and needs 20 | - University calendar changes 21 | - Unexpected closures 22 | 23 | All changes will be announced in class and posted on the course website. 24 | ::: 25 | -------------------------------------------------------------------------------- /website/modules/module-4/data-types-and-pandas.qmd: -------------------------------------------------------------------------------- 1 | # Data Types and Pandas 2 | 3 | ## What are the data types admitted in a Pandas object? 4 | 5 | ::: {.callout-note} 6 | **Question:** What are the data types admitted in a Pandas object? 7 | 8 | **Answer:** Mainly, Pandas uses NumPy arrays as the concrete objects contained with an Index, Series, or DataFrame. To recall the various NumPy dtypes, please refer to the sections on NumPy arrays. 9 | ::: 10 | 11 | ## Can a Series contain multiple data types? 12 | 13 | ::: {.callout-note} 14 | **Question:** Can a Series contain multiple data types? 15 | 16 | **Answer:** Yes, a Series can contain multiple data types (hence, a DataFrame can). In this sense, Pandas offers a more flexible data structure than NumPy arrays, which must contain objects of the same type. The code snippet below shows that a list with mixed types is downgraded to a NumPy array with string objects. Instead, a Series preserves the type of each object (see line 22). 17 | ::: 18 | 19 | ```python 20 | # import numpy and pandas with the socially accepted alias 'np' and 'pd' 21 | >>> import numpy as np 22 | >>> import pandas as pd 23 | 24 | # a list with a string, a float, and an integer 25 | >>> L = ["xyz", -17.64, 0] 26 | 27 | # create a NumPy array from the list 28 | >>> A = np.array(L) 29 | >>> print(A) 30 | ['xyz' '-17.64' '0'] 31 | 32 | # create a Series from the list 33 | >>> S = pd.Series(L) 34 | >>> print(S) 35 | 0 xyz 36 | 1 -17.64 37 | 2 0 38 | 39 | # proof that Series preserves the type of the individual object 40 | # --+ fetch the second item of the list and carry out a mathematical operation 41 | >>> S[1]/2 42 | -8.82 43 | ``` -------------------------------------------------------------------------------- /notes/_minted-notes/3669482A35653C3123AD335BC5937445764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the strings (data) to save permanently to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{B}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{C}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{D\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file and write DATA} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{)} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{n}{DATA}\PYG{p}{)} 8 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 9 | 10 | \PYG{c+c1}{\PYGZsh{} read multiple lines} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}}\PYG{p}{)} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{readlines}\PYG{p}{()} 13 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}A}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}B}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}C}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}D\PYGZsq{}}\PYG{p}{]} 14 | \end{Verbatim} 15 | -------------------------------------------------------------------------------- /notes/_minted-notes/299B0631796C987E50C0FE86A50ADA35764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} create all permutations of letters and colors and print them} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{LETTERS}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{k}{for} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n}{COLORS}\PYG{p}{:} 9 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{} \PYGZhy{} \PYGZdq{}}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} 10 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 11 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 12 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 13 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 14 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 15 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 16 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 17 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 18 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 19 | \end{Verbatim} 20 | -------------------------------------------------------------------------------- /notes/_minted-notes/299B0631796C987E50C0FE86A50ADA35B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} create all permutations of letters and colors and print them} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{LETTERS}\PYG{p}{:} 8 | \PYG{o}{...} \PYG{k}{for} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n}{COLORS}\PYG{p}{:} 9 | \PYG{o}{...} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{} \PYGZhy{} \PYGZdq{}}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} 10 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 11 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 12 | \PYG{n}{x} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 13 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 14 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 15 | \PYG{n}{y} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 16 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{blue} 17 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{green} 18 | \PYG{n}{z} \PYG{o}{\PYGZlt{}\PYGZhy{}\PYGZgt{}} \PYG{n}{red} 19 | \end{Verbatim} 20 | -------------------------------------------------------------------------------- /notes/data/python.dat: -------------------------------------------------------------------------------- 1 | 0 24 2 | 1 26 3 | 2 27 4 | 3 26 5 | 4 26 6 | 5 26 7 | 6 24 8 | 7 24 9 | 8 25 10 | 9 26 11 | 10 27 12 | 11 25 13 | 12 25 14 | 13 27 15 | 14 27 16 | 15 26 17 | 16 27 18 | 17 26 19 | 18 26 20 | 19 26 21 | 20 26 22 | 21 26 23 | 22 27 24 | 23 25 25 | 24 25 26 | 25 26 27 | 26 28 28 | 27 27 29 | 28 27 30 | 29 26 31 | 30 26 32 | 31 26 33 | 32 28 34 | 33 29 35 | 34 29 36 | 35 26 37 | 36 29 38 | 37 30 39 | 38 30 40 | 39 31 41 | 40 30 42 | 41 30 43 | 42 30 44 | 43 30 45 | 44 31 46 | 45 33 47 | 46 34 48 | 47 31 49 | 48 31 50 | 49 34 51 | 50 34 52 | 51 34 53 | 52 33 54 | 53 32 55 | 54 32 56 | 55 30 57 | 56 35 58 | 57 37 59 | 58 36 60 | 59 32 61 | 60 33 62 | 61 38 63 | 62 38 64 | 63 39 65 | 64 37 66 | 65 38 67 | 66 38 68 | 67 36 69 | 68 41 70 | 69 42 71 | 70 41 72 | 71 38 73 | 72 43 74 | 73 49 75 | 74 49 76 | 75 48 77 | 76 47 78 | 77 49 79 | 78 45 80 | 79 45 81 | 80 51 82 | 81 55 83 | 82 58 84 | 83 51 85 | 84 55 86 | 85 62 87 | 86 68 88 | 87 63 89 | 88 62 90 | 89 62 91 | 90 59 92 | 91 63 93 | 92 68 94 | 93 72 95 | 94 73 96 | 95 64 97 | 96 66 98 | 97 75 99 | 98 76 100 | 99 73 101 | 100 74 102 | 101 74 103 | 102 73 104 | 103 73 105 | 104 76 106 | 105 83 107 | 106 83 108 | 107 69 109 | 108 76 110 | 109 84 111 | 110 85 112 | 111 84 113 | 112 82 114 | 113 84 115 | 114 88 116 | 115 83 117 | 116 95 118 | 117 97 119 | 118 97 120 | 119 82 121 | 120 87 122 | 121 97 123 | 122 92 124 | 123 100 125 | 124 94 126 | 125 96 127 | 126 93 128 | 127 91 129 | 128 93 130 | 129 78 131 | 130 73 132 | 131 72 133 | 132 71 134 | 133 76 135 | 134 84 136 | 135 82 137 | 136 77 138 | 137 79 139 | 138 77 140 | 139 72 141 | 140 85 142 | 141 88 143 | 142 95 144 | 143 88 145 | -------------------------------------------------------------------------------- /notes/_minted-notes/78D2A57E659E3ECFFC57BE2B8A8146FB764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | 3 | \PYG{c+c1}{\PYGZsh{} let us assign the variables 'x' and 'y' to two number objects} 4 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{2} 5 | 6 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mf}{4.0} 7 | 8 | \PYG{c+c1}{\PYGZsh{} subtracting an integer from variable 'x'} 9 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{1} 10 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mi}{1} 11 | 12 | \PYG{c+c1}{\PYGZsh{} dividing the variable 'y' by an integer} 13 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{]:} \PYG{n}{y} \PYG{o}{/} \PYG{l+m+mi}{73} 14 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{]:} \PYG{l+m+mf}{0.0547945205479452} 15 | 16 | \PYG{c+c1}{\PYGZsh{} integer-dividing the variable 'y' by an integer} 17 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{5}\PYG{p}{]:} \PYG{n}{y} \PYG{o}{//} \PYG{l+m+mi}{73} 18 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{5}\PYG{p}{]:} \PYG{l+m+mf}{0.0} 19 | 20 | \PYG{c+c1}{\PYGZsh{} getting a linear combination of 'x' and 'y'} 21 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{6}\PYG{p}{]:} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 22 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{6}\PYG{p}{]:} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{14.0} 23 | 24 | \PYG{c+c1}{\PYGZsh{} assigning the variable 'z' to the linear combination of 'x' and 'y'} 25 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{]:} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{n}{x} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{5} \PYG{o}{*} \PYG{n}{y} 26 | \end{Verbatim} 27 | -------------------------------------------------------------------------------- /website/modules/module-3/universal-functions.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Universal Functions in NumPy" 3 | --- 4 | 5 | ::: {.callout-note} 6 | ## Question 7 | What is a universal function? 8 | ::: 9 | 10 | ::: {.callout-tip} 11 | ## Answer 12 | A universal function, or [`ufunc`](https://numpy.org/doc/stable/reference/ufuncs.html), is a function that performs element-wise operations on `ndarrays`. You can think of them as fast vectorized wrappers for simple functions that take one or more scalar values and produce one or more scalar results. 13 | 14 | Here is an interesting passage from the official [NumPy](https://numpy.org/doc/stable/glossary.html#term-vectorization) documentation: *NumPy hands off array processing to C, where looping and computation are much faster than in Python. To exploit this, programmers using NumPy eliminate Python loops in favor of array-to-array operations. vectorization can refer both to the C offloading and to structuring NumPy code to leverage it.* 15 | ::: 16 | 17 | ::: {.callout-note} 18 | ## Question 19 | What is the rationale for using `ufuncs`? 20 | ::: 21 | 22 | ::: {.callout-tip} 23 | ## Answer 24 | Per the previous point, using a [`ufunc`](https://numpy.org/doc/stable/reference/ufuncs.html) offer substantial performance advantages *vis a' vis* non-vectorized code --- i.e., code using built-in Python iterators. 25 | ::: 26 | 27 | ::: {.callout-note} 28 | ## Question 29 | What are the `ufunc` options available in NumPy? 30 | ::: 31 | 32 | ::: {.callout-tip} 33 | ## Answer 34 | There are circa sixty universal functions implemented in NumPy. For the sake of convenience, the full list of [`ufunc`](https://numpy.org/doc/stable/reference/ufuncs.html) options is available in the NumPy documentation. The following sections of the current chapter will illustrate how to use some of the popular central `ufuncs` in NumPy. 35 | ::: -------------------------------------------------------------------------------- /notes/_minted-notes/A4AE5492CB42844DAD7B13205B950062764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the strings (data) to save permanently to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{DATA} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}The first line}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{The second line\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file and write DATA} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{)} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{n}{DATA}\PYG{p}{)} 8 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 9 | 10 | \PYG{c+c1}{\PYGZsh{} read one line from the file} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}r\PYGZdq{}}\PYG{p}{)} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{readline}\PYG{p}{()} 13 | \PYG{l+s+s2}{\PYGZdq{}The first line}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{\PYGZdq{}} 14 | 15 | \PYG{c+c1}{\PYGZsh{} calling file.readline() again reds the subsequent line} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{readline}\PYG{p}{()} 17 | \PYG{l+s+s2}{\PYGZdq{}The second line\PYGZdq{}} 18 | 19 | \PYG{c+c1}{\PYGZsh{} ... and so on until the end of the file is reached} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{readline}\PYG{p}{()} 21 | \PYG{l+s+s2}{\PYGZdq{}\PYGZdq{}} 22 | \end{Verbatim} 23 | -------------------------------------------------------------------------------- /notes/_minted-notes/3F680C2693DE03692D6A2B0A236EDB37B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create two sets} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{])} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{Y} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}d\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}e\PYGZdq{}}\PYG{p}{])} 5 | 6 | \PYG{c+c1}{\PYGZsh{} set difference} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZhy{}} \PYG{n}{X} 8 | \PYG{n+nb}{set}\PYG{p}{()} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZhy{}} \PYG{n}{Y} 10 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{\PYGZcb{}} 11 | 12 | \PYG{c+c1}{\PYGZsh{} union} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{|} \PYG{n}{Y} 14 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}d\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}e\PYGZdq{}}\PYG{p}{\PYGZcb{}} 15 | 16 | \PYG{c+c1}{\PYGZsh{} intersection} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZam{}} \PYG{n}{Y} 18 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{\PYGZcb{}} 19 | 20 | \PYG{c+c1}{\PYGZsh{} superset} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZgt{}} \PYG{n}{Y} 22 | \PYG{k+kc}{False} 23 | 24 | \PYG{c+c1}{\PYGZsh{} subset} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZlt{}} \PYG{n}{Y} 26 | \PYG{k+kc}{False} 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/D59E1B047169E16DD6A0E06D6D6068A3764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create two sets} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{])} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{Y} \PYG{o}{=} \PYG{n+nb}{set}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}d\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}e\PYGZdq{}}\PYG{p}{])} 5 | 6 | \PYG{c+c1}{\PYGZsh{} set difference} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZhy{}} \PYG{n}{X} 8 | \PYG{n+nb}{set}\PYG{p}{()} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZhy{}} \PYG{n}{Y} 10 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{\PYGZcb{}} 11 | 12 | \PYG{c+c1}{\PYGZsh{} union} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{|} \PYG{n}{Y} 14 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}a\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}b\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}d\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}e\PYGZdq{}}\PYG{p}{\PYGZcb{}} 15 | 16 | \PYG{c+c1}{\PYGZsh{} intersection} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZam{}} \PYG{n}{Y} 18 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}c\PYGZdq{}}\PYG{p}{\PYGZcb{}} 19 | 20 | \PYG{c+c1}{\PYGZsh{} superset} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZgt{}} \PYG{n}{Y} 22 | \PYG{k+kc}{False} 23 | 24 | \PYG{c+c1}{\PYGZsh{} subset} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{X} \PYG{o}{\PYGZlt{}} \PYG{n}{Y} 26 | \PYG{k+kc}{False} 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /CLAUDE.md: -------------------------------------------------------------------------------- 1 | # CLAUDE.md 2 | 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. 4 | 5 | ## Project Overview 6 | 7 | This is an educational repository for "Introduction to Python - IND216/SMM692" course. The repository contains LaTeX-based course notes and supporting materials for teaching Python programming. 8 | 9 | ## Project Structure 10 | 11 | - `notes/` - Main directory containing course materials 12 | - `notes.tex` - LaTeX source for course notes 13 | - `notes.pdf` - Compiled PDF output 14 | - `data/` - Sample data files used in examples 15 | - Various `.png` images - Screenshots and diagrams for the course 16 | - `.pgf` files - Plot graphics for the notes 17 | - `.npy`/`.npz` files - NumPy data files for examples 18 | 19 | ## Build Commands 20 | 21 | ### LaTeX Document Compilation 22 | To compile the course notes PDF: 23 | ```bash 24 | cd notes 25 | pdflatex -shell-escape notes.tex 26 | ``` 27 | Note: The `-shell-escape` flag is required for the `minted` package used for code syntax highlighting. 28 | 29 | For complete compilation with references and table of contents: 30 | ```bash 31 | cd notes 32 | pdflatex -shell-escape notes.tex 33 | pdflatex -shell-escape notes.tex # Run twice for references 34 | ``` 35 | 36 | ## Key Dependencies 37 | 38 | The LaTeX document uses: 39 | - `minted` package for Python code syntax highlighting (requires Python Pygments) 40 | - `tcolorbox` for code listing environments 41 | - Standard LaTeX packages for mathematics and formatting 42 | 43 | ## Development Notes 44 | 45 | - The repository is primarily for educational content, not a software project 46 | - Python code snippets are embedded within the LaTeX document 47 | - No Python package management files (requirements.txt, setup.py, etc.) as this is documentation-focused 48 | - Git is tracking changes to the PDF and auxiliary LaTeX files -------------------------------------------------------------------------------- /notes/_minted-notes/D9AB99930269DBCE855E8129343E594A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTERS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}x\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}y\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}z\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{COLORS} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}blue\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}green\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}red\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} implementing a nested for loop with a list comprehension} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{LETTER2COLOR} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZob{}\PYGZcb{}}\PYG{l+s+s2}{ \PYGZlt{}\PYGZhy{}\PYGZgt{} }\PYG{l+s+si}{\PYGZob{}\PYGZcb{}}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{n}{j}\PYG{p}{)} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{LETTERS} \PYG{k}{for} \PYG{n}{j} \PYG{o+ow}{in} \PYG{n}{COLORS}\PYG{p}{]} 8 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}x \PYGZlt{}\PYGZhy{}\PYGZgt{} blue\PYGZsq{}}\PYG{p}{,} 9 | \PYG{l+s+s1}{\PYGZsq{}x \PYGZlt{}\PYGZhy{}\PYGZgt{} green\PYGZsq{}}\PYG{p}{,} 10 | \PYG{l+s+s1}{\PYGZsq{}x \PYGZlt{}\PYGZhy{}\PYGZgt{} red\PYGZsq{}}\PYG{p}{,} 11 | \PYG{l+s+s1}{\PYGZsq{}y \PYGZlt{}\PYGZhy{}\PYGZgt{} blue\PYGZsq{}}\PYG{p}{,} 12 | \PYG{l+s+s1}{\PYGZsq{}y \PYGZlt{}\PYGZhy{}\PYGZgt{} green\PYGZsq{}}\PYG{p}{,} 13 | \PYG{l+s+s1}{\PYGZsq{}y \PYGZlt{}\PYGZhy{}\PYGZgt{} red\PYGZsq{}}\PYG{p}{,} 14 | \PYG{l+s+s1}{\PYGZsq{}z \PYGZlt{}\PYGZhy{}\PYGZgt{} blue\PYGZsq{}}\PYG{p}{,} 15 | \PYG{l+s+s1}{\PYGZsq{}z \PYGZlt{}\PYGZhy{}\PYGZgt{} green\PYGZsq{}}\PYG{p}{,} 16 | \PYG{l+s+s1}{\PYGZsq{}z \PYGZlt{}\PYGZhy{}\PYGZgt{} red\PYGZsq{}}\PYG{p}{]} 17 | \end{Verbatim} 18 | -------------------------------------------------------------------------------- /notes/_minted-notes/1F9F889A329993A23E484B930F0DF797B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the arrays} 6 | \PYG{n}{X} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{10}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{])} 7 | \PYG{n}{Y} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{])} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get Pearson's correlation coefficients} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{corrcoef}\PYG{p}{(}\PYG{n}{X}\PYG{p}{,} \PYG{n}{Y}\PYG{p}{)} 11 | \PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.19763628}\PYG{p}{],} 12 | \PYG{p}{[}\PYG{l+m+mf}{0.19763628}\PYG{p}{,} \PYG{l+m+mf}{1.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/E320E8328B93103498FE167469E65BB2764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the arrays} 6 | \PYG{n}{X} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{10}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{])} 7 | \PYG{n}{Y} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{])} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get Pearson's correlation coefficients} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{corrcoef}\PYG{p}{(}\PYG{n}{X}\PYG{p}{,} \PYG{n}{Y}\PYG{p}{)} 11 | \PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.19763628}\PYG{p}{],} 12 | \PYG{p}{[}\PYG{l+m+mf}{0.19763628}\PYG{p}{,} \PYG{l+m+mf}{1.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/E320E8328B93103498FE167469E65BB2B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the arrays} 6 | \PYG{n}{X} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{10}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{])} 7 | \PYG{n}{Y} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{6}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{15}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{])} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get Pearson's correlation coefficients} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{corrcoef}\PYG{p}{(}\PYG{n}{X}\PYG{p}{,} \PYG{n}{Y}\PYG{p}{)} 11 | \PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mf}{1.} \PYG{p}{,} \PYG{l+m+mf}{0.19763628}\PYG{p}{],} 12 | \PYG{p}{[}\PYG{l+m+mf}{0.19763628}\PYG{p}{,} \PYG{l+m+mf}{1.} \PYG{p}{]])} 13 | \end{Verbatim} 14 | -------------------------------------------------------------------------------- /notes/_minted-notes/13ACDD6E77E86DB548E01BB8E6686AAD764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} create two lists} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L1} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Penny\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{]} 5 | 6 | \PYG{c+c1}{\PYGZsh{} expand an existing list with .append()} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{)} 8 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 9 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{]} 10 | 11 | \PYG{c+c1}{\PYGZsh{} concatenate L1 and L2 with .extend()} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L1}\PYG{o}{.}\PYG{n}{extend}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L1}\PYG{p}{)} 14 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Penny\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Bernadette\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Priya\PYGZdq{}}\PYG{p}{]} 15 | \end{Verbatim} 16 | -------------------------------------------------------------------------------- /notes/_minted-notes/D59B78B46668A255A2DBA9FE73776612764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign S to a string object} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}The first version of Python was released in 1991\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} search for "Python" in S} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{find}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Python\PYGZdq{}}\PYG{p}{)} 7 | \PYG{l+m+mi}{21} 8 | 9 | \PYG{c+c1}{\PYGZsh{} search for "Julia" in S} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{find}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Julia\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1} 12 | 13 | \PYG{c+c1}{\PYGZsh{} slice the string the get Python's release year information} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS} \PYG{o}{=} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{4}\PYG{p}{:]} 15 | 16 | \PYG{c+c1}{\PYGZsh{} display SS} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS} 18 | \PYG{l+s+s2}{\PYGZdq{}1991\PYGZdq{}} 19 | 20 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 22 | \PYG{k+kc}{True} 23 | 24 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 26 | \PYG{k+kc}{True} 27 | 28 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 29 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 30 | \PYG{k+kc}{True} 31 | 32 | \PYG{c+c1}{\PYGZsh{} test if S ends with "1991" / SS} 33 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{endswith}\PYG{p}{(}\PYG{n}{SS}\PYG{p}{)} 34 | \PYG{k+kc}{True} 35 | \end{Verbatim} 36 | -------------------------------------------------------------------------------- /notes/_minted-notes/D59B78B46668A255A2DBA9FE73776612B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign S to a string object} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}The first version of Python was released in 1991\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} search for "Python" in S} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{find}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Python\PYGZdq{}}\PYG{p}{)} 7 | \PYG{l+m+mi}{21} 8 | 9 | \PYG{c+c1}{\PYGZsh{} search for "Julia" in S} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{find}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Julia\PYGZdq{}}\PYG{p}{)} 11 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1} 12 | 13 | \PYG{c+c1}{\PYGZsh{} slice the string the get Python's release year information} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS} \PYG{o}{=} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{4}\PYG{p}{:]} 15 | 16 | \PYG{c+c1}{\PYGZsh{} display SS} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS} 18 | \PYG{l+s+s2}{\PYGZdq{}1991\PYGZdq{}} 19 | 20 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 22 | \PYG{k+kc}{True} 23 | 24 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 26 | \PYG{k+kc}{True} 27 | 28 | \PYG{c+c1}{\PYGZsh{} test if all characters in SS are digits} 29 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SS}\PYG{o}{.}\PYG{n}{isdigit}\PYG{p}{()} 30 | \PYG{k+kc}{True} 31 | 32 | \PYG{c+c1}{\PYGZsh{} test if S ends with "1991" / SS} 33 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{endswith}\PYG{p}{(}\PYG{n}{SS}\PYG{p}{)} 34 | \PYG{k+kc}{True} 35 | \end{Verbatim} 36 | -------------------------------------------------------------------------------- /notes/_minted-notes/8E7D3D59DECDC496828A28CF5B8BA78B764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} let's fetch Captain Marvel's position in the Marvel characters' power rank} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{]} 7 | \PYG{l+m+mi}{3} 8 | 9 | \PYG{c+c1}{\PYGZsh{} a dictionary of dictionaries} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}} 11 | \PYG{l+s+s2}{\PYGZdq{}Dr. Strange\PYGZdq{}}\PYG{p}{:} \PYG{p}{\PYGZob{}} 12 | \PYG{l+s+s2}{\PYGZdq{}first\PYGZus{}appearance\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1963}\PYG{p}{,} 13 | \PYG{l+s+s2}{\PYGZdq{}created\PYGZus{}by\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}Lee \PYGZam{} Ditko\PYGZdq{}} 14 | \PYG{p}{\PYGZcb{},} 15 | \PYG{l+s+s2}{\PYGZdq{}Iron Man\PYGZdq{}}\PYG{p}{:} \PYG{p}{\PYGZob{}} 16 | \PYG{l+s+s2}{\PYGZdq{}first\PYGZus{}appearance\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1963}\PYG{p}{,} 17 | \PYG{l+s+s2}{\PYGZdq{}created\PYGZus{}by\PYGZdq{}}\PYG{p}{:} \PYG{l+s+s2}{\PYGZdq{}Lee, Lieber, Heck \PYGZam{} Kirby\PYGZdq{}} 18 | \PYG{p}{\PYGZcb{},} 19 | \PYG{p}{\PYGZcb{}} 20 | 21 | \PYG{c+c1}{\PYGZsh{} let us fetch the creator of Dr. Strange} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Dr. Strange\PYGZdq{}}\PYG{p}{][}\PYG{l+s+s2}{\PYGZdq{}created\PYGZus{}by\PYGZdq{}}\PYG{p}{]} 23 | \PYG{l+s+s2}{\PYGZdq{}Lee \PYGZam{} Ditko\PYGZdq{}} 24 | \end{Verbatim} 25 | -------------------------------------------------------------------------------- /notes/_minted-notes/019F1608FBF8EB28D01B10AD91BDB35C764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy and pandas with the socially accepted alias 'np' and 'pd'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 5 | 6 | \PYG{c+c1}{\PYGZsh{} a list with a string, a float, and an integer} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}xyz\PYGZdq{}}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} create a NumPy array from the list} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{A}\PYG{p}{)} 12 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}xyz\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}\PYGZhy{}17.64\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}0\PYGZsq{}}\PYG{p}{]} 13 | 14 | \PYG{c+c1}{\PYGZsh{} create a Series from the list} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Series}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 17 | \PYG{l+m+mi}{0} \PYG{n}{xyz} 18 | \PYG{l+m+mi}{1} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64} 19 | \PYG{l+m+mi}{2} \PYG{l+m+mi}{0} 20 | 21 | \PYG{c+c1}{\PYGZsh{} proof that Series preserves the type of the individual object} 22 | \PYG{c+c1}{\PYGZsh{} --+ fetch the second item of the list and carry out a mathematical operation} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{o}{/}\PYG{l+m+mi}{2} 24 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{8.82} 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/_minted-notes/019F1608FBF8EB28D01B10AD91BDB35CB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy and pandas with the socially accepted alias 'np' and 'pd'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 5 | 6 | \PYG{c+c1}{\PYGZsh{} a list with a string, a float, and an integer} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}xyz\PYGZdq{}}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} create a NumPy array from the list} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{A}\PYG{p}{)} 12 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}xyz\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}\PYGZhy{}17.64\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}0\PYGZsq{}}\PYG{p}{]} 13 | 14 | \PYG{c+c1}{\PYGZsh{} create a Series from the list} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Series}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 17 | \PYG{l+m+mi}{0} \PYG{n}{xyz} 18 | \PYG{l+m+mi}{1} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64} 19 | \PYG{l+m+mi}{2} \PYG{l+m+mi}{0} 20 | 21 | \PYG{c+c1}{\PYGZsh{} proof that Series preserves the type of the individual object} 22 | \PYG{c+c1}{\PYGZsh{} --+ fetch the second item of the list and carry out a mathematical operation} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{o}{/}\PYG{l+m+mi}{2} 24 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{8.82} 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/_minted-notes/2412612A10D149EBD64F4851B8398DBCB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy and pandas with the socially accepted alias 'np' and 'pd'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{pandas} \PYG{k}{as} \PYG{n+nn}{pd} 5 | 6 | \PYG{c+c1}{\PYGZsh{} a list with a string, a float, and an integer} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}xyz\PYGZdq{}}\PYG{p}{,} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{]} 8 | 9 | \PYG{c+c1}{\PYGZsh{} create a NumPy array from the list} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{A}\PYG{p}{)} 12 | \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}xyz\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}\PYGZhy{}17.64\PYGZsq{}} \PYG{l+s+s1}{\PYGZsq{}0\PYGZsq{}}\PYG{p}{]} 13 | 14 | \PYG{c+c1}{\PYGZsh{} create a Series from the list} 15 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{pd}\PYG{o}{.}\PYG{n}{Series}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 17 | \PYG{l+m+mi}{0} \PYG{n}{xyz} 18 | \PYG{l+m+mi}{1} \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{17.64} 19 | \PYG{l+m+mi}{2} \PYG{l+m+mi}{0} 20 | 21 | \PYG{c+c1}{\PYGZsh{} proof that Series preserves the type of the individual object} 22 | \PYG{c+c1}{\PYGZsh{} --+ fetch the second item of the list and carry out a mathematical operation} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{o}{/}\PYG{l+m+mi}{2} 24 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{8.82} 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/_minted-notes/DBE2334814879018F08053510C443709764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the math module} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{math} 4 | 5 | \PYG{c+c1}{\PYGZsh{} base-y log of x} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{log}\PYG{p}{(}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{)} 7 | \PYG{l+m+mf}{1.1949875002403856} 8 | 9 | \PYG{c+c1}{\PYGZsh{} base-10 log of x} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{log10}\PYG{p}{(}\PYG{l+m+mi}{12}\PYG{p}{)} 11 | \PYG{l+m+mf}{1.0791812460476249} 12 | 13 | \PYG{c+c1}{\PYGZsh{} import the random module} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{random} 15 | 16 | \PYG{c+c1}{\PYGZsh{} a draw from a normal distribution with mean = 0 and standard deviation = 1} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{random}\PYG{o}{.}\PYG{n}{normalvariate}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{)} 18 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{0.136017752991189} 19 | 20 | \PYG{c+c1}{\PYGZsh{} trigonometric functions} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{cos}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 22 | \PYG{l+m+mf}{1.0} 23 | 24 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{sin}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 25 | \PYG{l+m+mf}{0.0} 26 | 27 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{tan}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 28 | \PYG{l+m+mf}{0.0} 29 | 30 | \PYG{c+c1}{\PYGZsh{} an expression containing a factorial product} 31 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{factorial}\PYG{p}{(}\PYG{l+m+mi}{4}\PYG{p}{)} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{4} \PYG{o}{*} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{l+m+mi}{2} \PYG{o}{*} \PYG{l+m+mi}{1} 32 | \PYG{l+m+mi}{0} 33 | \end{Verbatim} 34 | -------------------------------------------------------------------------------- /notes/_minted-notes/DBE2334814879018F08053510C443709B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the math module} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{math} 4 | 5 | \PYG{c+c1}{\PYGZsh{} base-y log of x} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{log}\PYG{p}{(}\PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{)} 7 | \PYG{l+m+mf}{1.1949875002403856} 8 | 9 | \PYG{c+c1}{\PYGZsh{} base-10 log of x} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{log10}\PYG{p}{(}\PYG{l+m+mi}{12}\PYG{p}{)} 11 | \PYG{l+m+mf}{1.0791812460476249} 12 | 13 | \PYG{c+c1}{\PYGZsh{} import the random module} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{random} 15 | 16 | \PYG{c+c1}{\PYGZsh{} a draw from a normal distribution with mean = 0 and standard deviation = 1} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{random}\PYG{o}{.}\PYG{n}{normalvariate}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{)} 18 | \PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{0.136017752991189} 19 | 20 | \PYG{c+c1}{\PYGZsh{} trigonometric functions} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{cos}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 22 | \PYG{l+m+mf}{1.0} 23 | 24 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{sin}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 25 | \PYG{l+m+mf}{0.0} 26 | 27 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{tan}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 28 | \PYG{l+m+mf}{0.0} 29 | 30 | \PYG{c+c1}{\PYGZsh{} an expression containing a factorial product} 31 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{math}\PYG{o}{.}\PYG{n}{factorial}\PYG{p}{(}\PYG{l+m+mi}{4}\PYG{p}{)} \PYG{o}{\PYGZhy{}} \PYG{l+m+mi}{4} \PYG{o}{*} \PYG{l+m+mi}{3} \PYG{o}{*} \PYG{l+m+mi}{2} \PYG{o}{*} \PYG{l+m+mi}{1} 32 | \PYG{l+m+mi}{0} 33 | \end{Verbatim} 34 | -------------------------------------------------------------------------------- /notes/_minted-notes/C10F51FD5313FD897394FF2504599BFB764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the strings (data) to save permanently to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{FIRSTLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot may not injure a human being or, through inaction, \PYGZdq{}}\PYGZbs{} 4 | \PYG{l+s+s2}{\PYGZdq{}allow a human being to come to harm.\PYGZdq{}} 5 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SECONDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must obey the orders given it by human beings except \PYGZdq{}}\PYGZbs{} 6 | \PYG{l+s+s2}{\PYGZdq{}where such orders would conflict with the First Law.\PYGZdq{}} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{THIRDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must protect its own existence as long as such \PYGZdq{}}\PYGZbs{} 8 | \PYG{l+s+s2}{\PYGZdq{}protection does not conflict with the First or Second Law.\PYGZdq{}} 9 | 10 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{)} 12 | 13 | \PYG{c+c1}{\PYGZsh{} concatenate the strings} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{TO\PYGZus{}WRITE} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{join}\PYG{p}{([}\PYG{n}{FIRSTLAW}\PYG{p}{,} \PYG{n}{SECONDLAW}\PYG{p}{,} \PYG{n}{THIRDLAW}\PYG{p}{])} 15 | 16 | \PYG{c+c1}{\PYGZsh{} write the concatenated strings} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{n}{TO\PYGZus{}WRITE}\PYG{p}{)} 18 | 19 | \PYG{c+c1}{\PYGZsh{} close the pipe} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 21 | \end{Verbatim} 22 | -------------------------------------------------------------------------------- /notes/_minted-notes/C10F51FD5313FD897394FF2504599BFBB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the strings (data) to save permanently to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{FIRSTLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot may not injure a human being or, through inaction, \PYGZdq{}}\PYGZbs{} 4 | \PYG{l+s+s2}{\PYGZdq{}allow a human being to come to harm.\PYGZdq{}} 5 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SECONDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must obey the orders given it by human beings except \PYGZdq{}}\PYGZbs{} 6 | \PYG{l+s+s2}{\PYGZdq{}where such orders would conflict with the First Law.\PYGZdq{}} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{THIRDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must protect its own existence as long as such \PYGZdq{}}\PYGZbs{} 8 | \PYG{l+s+s2}{\PYGZdq{}protection does not conflict with the First or Second Law.\PYGZdq{}} 9 | 10 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{)} 12 | 13 | \PYG{c+c1}{\PYGZsh{} concatenate the strings} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{TO\PYGZus{}WRITE} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{join}\PYG{p}{([}\PYG{n}{FIRSTLAW}\PYG{p}{,} \PYG{n}{SECONDLAW}\PYG{p}{,} \PYG{n}{THIRDLAW}\PYG{p}{])} 15 | 16 | \PYG{c+c1}{\PYGZsh{} write the concatenated strings} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{n}{TO\PYGZus{}WRITE}\PYG{p}{)} 18 | 19 | \PYG{c+c1}{\PYGZsh{} close the pipe} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 21 | \end{Verbatim} 22 | -------------------------------------------------------------------------------- /notes/_minted-notes/D59E1B047169E16DD6A0E06D6D6068A3B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the strings (data) to save permanently to a file} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{FIRSTLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot may not injure a human being or, through inaction, \PYGZdq{}}\PYGZbs{} 4 | \PYG{l+s+s2}{\PYGZdq{}allow a human being to come to harm.\PYGZdq{}} 5 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{SECONDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must obey the orders given it by human beings except \PYGZdq{}}\PYGZbs{} 6 | \PYG{l+s+s2}{\PYGZdq{}where such orders would conflict with the First Law.\PYGZdq{}} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{THIRDLAW} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}A robot must protect its own existence as long as such \PYGZdq{}}\PYGZbs{} 8 | \PYG{l+s+s2}{\PYGZdq{}protection does not conflict with the First or Second Law.\PYGZdq{}} 9 | 10 | \PYG{c+c1}{\PYGZsh{} create a pipe to a file} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{n}{file}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}my\PYGZus{}file.txt\PYGZdq{}}\PYG{p}{,} \PYG{n}{mode}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}w\PYGZdq{}}\PYG{p}{)} 12 | 13 | \PYG{c+c1}{\PYGZsh{} concatenate the strings} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{TO\PYGZus{}WRITE} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+se}{\PYGZbs{}n}\PYG{l+s+s2}{\PYGZdq{}}\PYG{o}{.}\PYG{n}{join}\PYG{p}{([}\PYG{n}{FIRSTLAW}\PYG{p}{,} \PYG{n}{SECONDLAW}\PYG{p}{,} \PYG{n}{THIRDLAW}\PYG{p}{])} 15 | 16 | \PYG{c+c1}{\PYGZsh{} write the concatenated strings} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{n}{TO\PYGZus{}WRITE}\PYG{p}{)} 18 | 19 | \PYG{c+c1}{\PYGZsh{} close the pipe} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{file}\PYG{o}{.}\PYG{n}{close}\PYG{p}{()} 21 | \end{Verbatim} 22 | -------------------------------------------------------------------------------- /notes/_minted-notes/4505B9A259935687DC37B0F76DBD07D8764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the keys} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{keys}\PYG{p}{()} 7 | \PYG{n}{dict\PYGZus{}keys}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{])} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get the values} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{values}\PYG{p}{()} 11 | \PYG{n}{dict\PYGZus{}values}\PYG{p}{([}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{])} 12 | 13 | \PYG{c+c1}{\PYGZsh{} get the items} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{items}\PYG{p}{()} 15 | \PYG{n}{dict\PYGZus{}items}\PYG{p}{([(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{),} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{),} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{)])} 16 | 17 | \PYG{c+c1}{\PYGZsh{} get the keys as a list} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{list}\PYG{p}{(}\PYG{n}{D}\PYG{o}{.}\PYG{n}{keys}\PYG{p}{())} 19 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{]} 20 | \end{Verbatim} 21 | -------------------------------------------------------------------------------- /notes/_minted-notes/4505B9A259935687DC37B0F76DBD07D8B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} get the keys} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{keys}\PYG{p}{()} 7 | \PYG{n}{dict\PYGZus{}keys}\PYG{p}{([}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{])} 8 | 9 | \PYG{c+c1}{\PYGZsh{} get the values} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{values}\PYG{p}{()} 11 | \PYG{n}{dict\PYGZus{}values}\PYG{p}{([}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{])} 12 | 13 | \PYG{c+c1}{\PYGZsh{} get the items} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{o}{.}\PYG{n}{items}\PYG{p}{()} 15 | \PYG{n}{dict\PYGZus{}items}\PYG{p}{([(}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{),} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{),} \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{)])} 16 | 17 | \PYG{c+c1}{\PYGZsh{} get the keys as a list} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{list}\PYG{p}{(}\PYG{n}{D}\PYG{o}{.}\PYG{n}{keys}\PYG{p}{())} 19 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{]} 20 | \end{Verbatim} 21 | -------------------------------------------------------------------------------- /notes/_minted-notes/FBA5F4FB84AEF234D445AC316EB88E44764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign the string "Python 3.X" to the variable S} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Python 3.X\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} check the length of S} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 7 | \PYG{l+m+mi}{6} 8 | 9 | \PYG{c+c1}{\PYGZsh{} access the first unitary string in the sequence behind S } 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 11 | \PYG{l+s+s2}{\PYGZdq{}P\PYGZdq{}} 12 | 13 | \PYG{c+c1}{\PYGZsh{} access the last unitary string in the sequence behind S} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{]} 15 | \PYG{l+s+s2}{\PYGZdq{}X\PYGZdq{}} 16 | 17 | \PYG{c+c1}{\PYGZsh{} or, equivalently} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{]} 19 | \PYG{l+s+s2}{\PYGZdq{}X\PYGZdq{}} 20 | 21 | \PYG{c+c1}{\PYGZsh{} access the i-th, e.g., 3rd, unitary string in the sequence behind S} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]} 23 | \PYG{l+s+s2}{\PYGZdq{}h\PYGZdq{}} 24 | 25 | \PYG{c+c1}{\PYGZsh{} access the unitary strings between the i-th and j-th positions in the} 26 | \PYG{c+c1}{\PYGZsh{} sequence behind S} 27 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{:}\PYG{l+m+mi}{5}\PYG{p}{]} 28 | \PYG{l+s+s2}{\PYGZdq{}tho\PYGZdq{}} 29 | 30 | \PYG{c+c1}{\PYGZsh{} access the unitary strings following the i-th position in the sequence} 31 | \PYG{c+c1}{\PYGZsh{} behind S} 32 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{:]} 33 | \PYG{l+s+s2}{\PYGZdq{}3.X\PYGZdq{}} 34 | \end{Verbatim} 35 | -------------------------------------------------------------------------------- /website/modules/module-4/group-by-data-transformation.qmd: -------------------------------------------------------------------------------- 1 | # Group By Part II: Data Transformation 2 | 3 | ## Aggregate Vs. transform 4 | 5 | ::: {.callout-note} 6 | **Question:** Aggregate Vs. transform 7 | 8 | **Answer:** Once we have created a grouping structure, we can use it for aggregating the data (i.e., passing from monthly to yearly data points, see the previous section) as well as for expanding the source data. This procedure is called transformation and does not affect the number of rows in the DataFrame. 9 | 10 | In the code examples of this section, we get the cumulative sum of a product's sales for each period. Having defined the grouping structure, we use the [`.transform()`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.transform.html?highlight=transform#pandas.DataFrame.transform) method to apply NumPy's [`cumsum`](https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html) function to the values of `sales` that regard the same product. The outcome of the transformation is assigned to a new column like `cumulative_sales`. 11 | 12 | ```python 13 | # import the pandas library with the socially accepted alias 'pd' 14 | >>> import pandas as pd 15 | 16 | # the data frame 17 | >>> df = pd.DataFrame.from_dict( 18 | { 19 | "product": ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'], 20 | "month": [0, 0, 0, 1, 1, 1, 2, 2, 2], 21 | "sales": [10, 5, 0, 7, 6, 5, 4, 6, 9] 22 | } 23 | ) 24 | 25 | # data view 26 | >>> df 27 | product month sales 28 | 0 a 0 10 29 | 1 b 0 5 30 | 2 c 0 0 31 | ``` 32 | 33 | This section includes detailed examples showing how transformation differs from aggregation by maintaining the original number of rows while creating new calculated columns based on group-wise operations. 34 | ::: 35 | 36 | This section demonstrates various transformation operations that can be applied within groups, such as calculating running totals, standardizing values within groups, or computing group-relative statistics. -------------------------------------------------------------------------------- /notes/_minted-notes/FBA5F4FB84AEF234D445AC316EB88E44B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} let us assign the string "Python 3.X" to the variable S} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Python 3.X\PYGZdq{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} check the length of S} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)} 7 | \PYG{l+m+mi}{6} 8 | 9 | \PYG{c+c1}{\PYGZsh{} access the first unitary string in the sequence behind S } 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 11 | \PYG{l+s+s2}{\PYGZdq{}P\PYGZdq{}} 12 | 13 | \PYG{c+c1}{\PYGZsh{} access the last unitary string in the sequence behind S} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{S}\PYG{p}{)}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{]} 15 | \PYG{l+s+s2}{\PYGZdq{}X\PYGZdq{}} 16 | 17 | \PYG{c+c1}{\PYGZsh{} or, equivalently} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{]} 19 | \PYG{l+s+s2}{\PYGZdq{}X\PYGZdq{}} 20 | 21 | \PYG{c+c1}{\PYGZsh{} access the i-th, e.g., 3rd, unitary string in the sequence behind S} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]} 23 | \PYG{l+s+s2}{\PYGZdq{}h\PYGZdq{}} 24 | 25 | \PYG{c+c1}{\PYGZsh{} access the unitary strings between the i-th and j-th positions in the} 26 | \PYG{c+c1}{\PYGZsh{} sequence behind S} 27 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{:}\PYG{l+m+mi}{5}\PYG{p}{]} 28 | \PYG{l+s+s2}{\PYGZdq{}tho\PYGZdq{}} 29 | 30 | \PYG{c+c1}{\PYGZsh{} access the unitary strings following the i-th position in the sequence} 31 | \PYG{c+c1}{\PYGZsh{} behind S} 32 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{3}\PYG{p}{:]} 33 | \PYG{l+s+s2}{\PYGZdq{}3.X\PYGZdq{}} 34 | 35 | \end{Verbatim} 36 | -------------------------------------------------------------------------------- /notes/_minted-notes/FAFEF3CE429BB45945B4330A94B0E509764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a 0-D array} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 7 | \PYG{n}{array}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 8 | 9 | \PYG{c+c1}{\PYGZsh{} a 1-D array} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{])} 11 | \PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{])} 12 | 13 | \PYG{c+c1}{\PYGZsh{} a 2-D array} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 15 | \PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} 16 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 17 | 18 | \PYG{c+c1}{\PYGZsh{} a 3-D array} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]],} \PYG{p}{[[}\PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{]]])} 20 | \PYG{n}{array}\PYG{p}{([[[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} 21 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]],} 22 | 23 | \PYG{p}{[[}\PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{],} 24 | \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{]]])} 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/_minted-notes/FAFEF3CE429BB45945B4330A94B0E509B8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} a 0-D array} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 7 | \PYG{n}{array}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)} 8 | 9 | \PYG{c+c1}{\PYGZsh{} a 1-D array} 10 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{])} 11 | \PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{])} 12 | 13 | \PYG{c+c1}{\PYGZsh{} a 2-D array} 14 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 15 | \PYG{n}{array}\PYG{p}{([[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} 16 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]])} 17 | 18 | \PYG{c+c1}{\PYGZsh{} a 3-D array} 19 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([[[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]],} \PYG{p}{[[}\PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{]]])} 20 | \PYG{n}{array}\PYG{p}{([[[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{],} 21 | \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{]],} 22 | 23 | \PYG{p}{[[}\PYG{l+m+mi}{5}\PYG{p}{,} \PYG{l+m+mi}{6}\PYG{p}{],} 24 | \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{l+m+mi}{8}\PYG{p}{]]])} 25 | 26 | \end{Verbatim} 27 | -------------------------------------------------------------------------------- /notes/_minted-notes/ACA6C0BE78748B6180D6E41632D80BC0764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} less than} 3 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{l+m+mi}{3} \PYG{o}{\PYGZlt{}} \PYG{l+m+mi}{2} 4 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]:} \PYG{k+kc}{False} 5 | 6 | \PYG{c+c1}{\PYGZsh{} greater than or equal} 7 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{l+m+mi}{1} \PYG{o}{\PYGZlt{}=} \PYG{l+m+mi}{2} 8 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]:} \PYG{k+kc}{True} 9 | 10 | \PYG{c+c1}{\PYGZsh{} equal} 11 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{l+m+mi}{2} \PYG{o}{==} \PYG{l+m+mi}{2} 12 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{3}\PYG{p}{]:} \PYG{k+kc}{True} 13 | 14 | \PYG{c+c1}{\PYGZsh{} not equal} 15 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{]:} \PYG{l+m+mi}{4} \PYG{o}{!=} \PYG{l+m+mi}{4} 16 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{4}\PYG{p}{]:} \PYG{k+kc}{False} 17 | 18 | \PYG{c+c1}{\PYGZsh{} range test} 19 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{5}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{=} \PYG{l+m+mi}{3} 20 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{6}\PYG{p}{]:} \PYG{n}{y} \PYG{o}{=} \PYG{l+m+mi}{5} 21 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{7}\PYG{p}{]:} \PYG{n}{z} \PYG{o}{=} \PYG{l+m+mi}{4} 22 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{8}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 23 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{8}\PYG{p}{]:} \PYG{k+kc}{False} 24 | 25 | \PYG{c+c1}{\PYGZsh{} joined test} 26 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{9}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{and} \PYG{n}{y} \PYG{o}{\PYGZgt{}} \PYG{n}{z} 27 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{9}\PYG{p}{]:} \PYG{k+kc}{True} 28 | 29 | \PYG{c+c1}{\PYGZsh{} disjoined test} 30 | \PYG{n}{In} \PYG{p}{[}\PYG{l+m+mi}{10}\PYG{p}{]:} \PYG{n}{x} \PYG{o}{\PYGZlt{}} \PYG{n}{y} \PYG{o+ow}{or} \PYG{n}{y} \PYG{o}{\PYGZlt{}} \PYG{n}{z} 31 | \PYG{n}{Out}\PYG{p}{[}\PYG{l+m+mi}{10}\PYG{p}{]:} \PYG{k+kc}{True} 32 | \end{Verbatim} 33 | -------------------------------------------------------------------------------- /notes/_minted-notes/110AC5DB8237DD890B9C771E85CFF14A764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} accept the default type} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{])} 7 | 8 | \PYG{c+c1}{\PYGZsh{} check the type} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A}\PYG{o}{.}\PYG{n}{dtype} 10 | \PYG{n}{dtype}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}int64\PYGZsq{}}\PYG{p}{)} 11 | 12 | \PYG{c+c1}{\PYGZsh{} specify the type} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{],} \PYG{n}{dtype}\PYG{o}{=}\PYG{n}{np}\PYG{o}{.}\PYG{n}{int32}\PYG{p}{)} 14 | 15 | \PYG{c+c1}{\PYGZsh{} check the type} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A}\PYG{o}{.}\PYG{n}{dtype} 17 | \PYG{n+nb}{type}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}int32\PYGZsq{}}\PYG{p}{)} 18 | 19 | \PYG{c+c1}{\PYGZsh{} type change} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+s+s1}{\PYGZsq{}1.25\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}\PYGZhy{}9.6\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}42\PYGZsq{}}\PYG{p}{],} \PYG{n}{dtype}\PYG{o}{=}\PYG{n}{np}\PYG{o}{.}\PYG{n}{string\PYGZus{}}\PYG{p}{)} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{S}\PYG{o}{.}\PYG{n}{astype}\PYG{p}{(}\PYG{n+nb}{float}\PYG{p}{)} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{dtype} 23 | \PYG{n}{dtype}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}float64\PYGZsq{}}\PYG{p}{)} 24 | \end{Verbatim} 25 | -------------------------------------------------------------------------------- /notes/_minted-notes/110AC5DB8237DD890B9C771E85CFF14AB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import numpy with the socially accepted alias 'np'} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k}{as} \PYG{n+nn}{np} 4 | 5 | \PYG{c+c1}{\PYGZsh{} accept the default type} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{])} 7 | 8 | \PYG{c+c1}{\PYGZsh{} check the type} 9 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A}\PYG{o}{.}\PYG{n}{dtype} 10 | \PYG{n}{dtype}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}int64\PYGZsq{}}\PYG{p}{)} 11 | 12 | \PYG{c+c1}{\PYGZsh{} specify the type} 13 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{],} \PYG{n}{dtype}\PYG{o}{=}\PYG{n}{np}\PYG{o}{.}\PYG{n}{int32}\PYG{p}{)} 14 | 15 | \PYG{c+c1}{\PYGZsh{} check the type} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{A}\PYG{o}{.}\PYG{n}{dtype} 17 | \PYG{n+nb}{type}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}int32\PYGZsq{}}\PYG{p}{)} 18 | 19 | \PYG{c+c1}{\PYGZsh{} type change} 20 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+s+s1}{\PYGZsq{}1.25\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}\PYGZhy{}9.6\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}42\PYGZsq{}}\PYG{p}{],} \PYG{n}{dtype}\PYG{o}{=}\PYG{n}{np}\PYG{o}{.}\PYG{n}{string\PYGZus{}}\PYG{p}{)} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S} \PYG{o}{=} \PYG{n}{S}\PYG{o}{.}\PYG{n}{astype}\PYG{p}{(}\PYG{n+nb}{float}\PYG{p}{)} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{S}\PYG{o}{.}\PYG{n}{dtype} 23 | \PYG{n}{dtype}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}float64\PYGZsq{}}\PYG{p}{)} 24 | 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/_minted-notes/6C4FE0567213F2340087B75669A155D3764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Penny\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} change the second item of L via indexing} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 8 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 9 | 10 | \PYG{c+c1}{\PYGZsh{} change multiple items of L via slicing} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{]} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 13 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 14 | 15 | \PYG{c+c1}{\PYGZsh{} delete the first item of L via indexing and using the 'del' statement} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{del} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 18 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 19 | 20 | \PYG{c+c1}{\PYGZsh{} delete multiple items of L via slicing and using the 'del' statement} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{del} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{]} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 23 | \PYG{p}{[]} 24 | \end{Verbatim} 25 | -------------------------------------------------------------------------------- /notes/_minted-notes/AD7C409334E078678AFF5AC7B16A28DEB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the list} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Penny\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 4 | 5 | \PYG{c+c1}{\PYGZsh{} change the second item of L via indexing} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 8 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Leonard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Raj\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 9 | 10 | \PYG{c+c1}{\PYGZsh{} change multiple items of L via slicing} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{]} \PYG{o}{=} \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 13 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Amy\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 14 | 15 | \PYG{c+c1}{\PYGZsh{} delete the first item of L via indexing and using the 'del' statement} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{del} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 18 | \PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Howard\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Sheldon\PYGZdq{}}\PYG{p}{]} 19 | 20 | \PYG{c+c1}{\PYGZsh{} delete multiple items of L via slicing and using the 'del' statement} 21 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{del} \PYG{n}{L}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{]} 22 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L}\PYG{p}{)} 23 | \PYG{p}{[]} 24 | 25 | \end{Verbatim} 26 | -------------------------------------------------------------------------------- /notes/notes.ent: -------------------------------------------------------------------------------- 1 | \@doanenote {1} 2 | macro:->Zagalsky, 3 | Alexey, 4 | Joseph 5 | Feliciano, 6 | Margaret-Anne 7 | Storey, 8 | Yiyun 9 | Zhao, 10 | and 11 | Weiliang 12 | Wang. 13 | ``The 14 | emergence 15 | of 16 | GitHub 17 | as 18 | a 19 | collaborative 20 | platform 21 | for 22 | education'' 23 | In 24 | \textit 25 | {Proceedings 26 | of 27 | the 28 | 18th 29 | ACM 30 | conference 31 | on 32 | computer 33 | supported 34 | cooperative 35 | work 36 | & 37 | social 38 | computing}, 39 | pp. 40 | 1906-1917. 41 | 2015. 42 | \@endanenote 43 | \@doanenote {2} 44 | macro:->Especially, 45 | GitHub 46 | users 47 | can 48 | fine-tune 49 | the 50 | amount 51 | of 52 | information 53 | to 54 | receive 55 | by 56 | selecting 57 | the 58 | following 59 | options: 60 | i) 61 | by 62 | following 63 | the 64 | user 65 | owning 66 | a 67 | repository, 68 | a 69 | learner 70 | gets 71 | their 72 | GitHub 73 | homepage 74 | with 75 | the 76 | recent 77 | activities 78 | performed 79 | by 80 | that 81 | user; 82 | ii) 83 | by 84 | starring 85 | a 86 | repository, 87 | a 88 | learner 89 | has 90 | access 91 | to 92 | shortcuts 93 | to 94 | quickly 95 | and 96 | conveniently 97 | access 98 | a 99 | GitHub 100 | repository; 101 | iii) 102 | by 103 | watching 104 | a 105 | repository, 106 | a 107 | learner 108 | receives 109 | emails 110 | regarding 111 | any 112 | edit 113 | regarding 114 | a 115 | GitHub 116 | repository. 117 | \@endanenote 118 | \@doanenote {3} 119 | macro:->The 120 | inter-temporal 121 | distribution 122 | of 123 | commits 124 | regarding 125 | SMM694 126 | is 127 | available 128 | at 129 | \url 130 | {https://github.com/simoneSantoni/NLP-orgs-markets/graphs/commit-activity} 131 | \@endanenote 132 | \@doanenote {4} 133 | macro:->Iiyoshi, 134 | Toru, 135 | and 136 | M. 137 | S. 138 | V. 139 | Kumar. 140 | \textit 141 | {Opening 142 | up 143 | education: 144 | The 145 | collective 146 | advancement 147 | of 148 | education 149 | through 150 | open 151 | technology, 152 | open 153 | content, 154 | and 155 | open 156 | knowledge}. 157 | The 158 | MIT 159 | Press, 160 | 2010. 161 | \@endanenote 162 | -------------------------------------------------------------------------------- /notes/_minted-notes/731064C23BCBBE64237ED22B2A83408B764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the function log from math} 3 | \PYG{k+kn}{from} \PYG{n+nn}{math} \PYG{k+kn}{import} \PYG{n}{log} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the object to manipulate} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L1} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} the for loop way} 9 | \PYG{c+c1}{\PYGZsh{} --+ the empty list} 10 | \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[]} 11 | \PYG{c+c1}{\PYGZsh{} --+ the for loop appending the log of some items} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{:} 13 | \PYG{o}{...} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{))} 15 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 16 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{))} 17 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 19 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 20 | 21 | \PYG{c+c1}{\PYGZsh{} the list comprehension way} 22 | \PYG{c+c1}{\PYGZsh{} --+ the list comprehension is a one-liner!} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{)} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0} \PYG{k}{else} \PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{)} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{]} 24 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 26 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/A3CF788BDDE65300804B48B0EF48D5CDB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the function log from math} 3 | \PYG{k+kn}{from} \PYG{n+nn}{math} \PYG{k+kn}{import} \PYG{n}{log} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the object to manipulate} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L1} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} the for loop way} 9 | \PYG{c+c1}{\PYGZsh{} --+ the empty list} 10 | \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[]} 11 | \PYG{c+c1}{\PYGZsh{} --+ the for loop appending the log of some items} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{:} 13 | \PYG{o}{...} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{))} 15 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 16 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{))} 17 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 19 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 20 | 21 | \PYG{c+c1}{\PYGZsh{} the list comprehension way} 22 | \PYG{c+c1}{\PYGZsh{} --+ the list comprehension is a one-liner!} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{)} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0} \PYG{k}{else} \PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{)} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{]} 24 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 26 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/AC16DBA75C89B2466264D0F56F243AEBB8572376E7183A887D9D0939E390FA18.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} import the function log from math} 3 | \PYG{k+kn}{from} \PYG{n+nn}{math} \PYG{k+kn}{import} \PYG{n}{log} 4 | 5 | \PYG{c+c1}{\PYGZsh{} the object to manipulate} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L1} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{]} 7 | 8 | \PYG{c+c1}{\PYGZsh{} the for loop way} 9 | \PYG{c+c1}{\PYGZsh{} --+ the empty list} 10 | \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[]} 11 | \PYG{c+c1}{\PYGZsh{} --+ the for loop appending the log of some items} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{:} 13 | \PYG{o}{...} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0}\PYG{p}{:} 14 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{))} 15 | \PYG{o}{...} \PYG{k}{else}\PYG{p}{:} 16 | \PYG{o}{...} \PYG{n}{L2}\PYG{o}{.}\PYG{n}{append}\PYG{p}{(}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{))} 17 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 18 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 19 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 20 | 21 | \PYG{c+c1}{\PYGZsh{} the list comprehension way} 22 | \PYG{c+c1}{\PYGZsh{} --+ the list comprehension is a one-liner!} 23 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{L2} \PYG{o}{=} \PYG{p}{[}\PYG{n}{log}\PYG{p}{(}\PYG{n}{i}\PYG{p}{)} \PYG{k}{if} \PYG{n}{i} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{0} \PYG{k}{else} \PYG{n}{log}\PYG{p}{(}\PYG{n}{i} \PYG{o}{+} \PYG{l+m+mf}{0.001}\PYG{p}{)} \PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n}{L1}\PYG{p}{]} 24 | \PYG{c+c1}{\PYGZsh{} --+ print the list} 25 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{L2}\PYG{p}{)} 26 | \PYG{p}{[}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{6.907755278982137}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{0.6931471805599453}\PYG{p}{]} 27 | \end{Verbatim} 28 | -------------------------------------------------------------------------------- /notes/_minted-notes/AD7C409334E078678AFF5AC7B16A28DE764ACE08D8ACD0933C5BDFEBD4BB53D4.pygtex: -------------------------------------------------------------------------------- 1 | \begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}] 2 | \PYG{c+c1}{\PYGZsh{} the dictionary} 3 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 4 | 5 | \PYG{c+c1}{\PYGZsh{} let us change the power rank for Captain Marvel} 6 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{]} \PYG{o}{=} \PYG{l+m+mi}{12} 7 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{D}\PYG{p}{)} 8 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 9 | 10 | \PYG{c+c1}{\PYGZsh{} let us eliminate the character Living Tribunal} 11 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{k}{del} \PYG{n}{D}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Living Tribunal\PYGZdq{}}\PYG{p}{]} 12 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{D}\PYG{p}{)} 13 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}} 14 | 15 | \PYG{c+c1}{\PYGZsh{} let us add a further character} 16 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n}{D}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}Wanda Maximoff\PYGZdq{}}\PYG{p}{]} \PYG{o}{=} \PYG{l+m+mi}{4} 17 | \PYG{o}{\PYGZgt{}\PYGZgt{}\PYGZgt{}} \PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{D}\PYG{p}{)} 18 | \PYG{p}{\PYGZob{}}\PYG{l+s+s2}{\PYGZdq{}Captain Marvel\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{12}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}One\PYGZhy{}Above\PYGZhy{}All\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Wanda Maximoff\PYGZdq{}}\PYG{p}{:} \PYG{l+m+mi}{4}\PYG{p}{\PYGZcb{}} 19 | \end{Verbatim} 20 | -------------------------------------------------------------------------------- /website/modules/module-2/python-statements-and-syntax.qmd: -------------------------------------------------------------------------------- 1 | # Python Statements and Syntax 2 | 3 | ::: {.callout-note} 4 | ## What is a Python statement? 5 | 6 | In his popular book 'Learning Python,' Lutz provides a concise and effective description of what a Python statement is: 7 | 8 | > *In simple terms, statements are the things you write to tell Python what your programs should do. If, as suggested [omitted], programs "do things with stuff," then statements are the way you specify what sort of things a program does. Less informally, Python is a procedural, statement-based language; by combining statements, you specify a procedure Python performs to satisfy a program's goals.* 9 | ::: 10 | 11 | ::: {.callout-note} 12 | ## What are the most common Python statements? 13 | 14 | Table 4.9 illustrates common Python statements, their role, and application examples. Some of these statements were used in the examples considered so far. Other statements --- the majority --- will be faced in the next sections of the current chapter and/or the subsequent chapters. 15 | ::: 16 | 17 | | Statement | Role | Example | 18 | |-----------|------|---------| 19 | | `import` | Module access | `import math` | 20 | | `from` | Attribute access | `from math import sqrt` | 21 | | `class` | Building ad hoc objects | `class Subclass(Superclass): def method(self): pass` | 22 | | `del` | Deleting references | `del a` | 23 | | Assignment | Creating references | `a = "before b"` | 24 | | Calls and other expressions | Running functions | `file.write("Hello")` | 25 | | `print` | Printing objects | `print("Hello")` | 26 | | `if/elif/else` | Selecting actions | `if "abc" in text: print(text)` | 27 | | `for/else` | Iteration | `for x in mylist: print(x)` | 28 | | `while/else` | General loops | `while X > Y: print("Hello")` | 29 | | `pass` | Empty placeholder | `while True: pass` | 30 | | `break` | Loop exit | `while True: if exit test(): break` | 31 | | `continue` | Loop continue | `while True: if skiptest(): continue` | 32 | | `def` | Functions and methods | `def f(a, b, c=1, *d): print(a+b+c+d[0])` | 33 | | `return` | Functions results | `def f(a, b, c=1, *d): return a+b+c+d[0]` | 34 | | `yield` | Generator functions | `def gen(n): for i in n: yield i*2` | 35 | 36 | : Python Statements {#tbl-python-statements} --------------------------------------------------------------------------------