forked from cotes2020/jekyll-theme-chirpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1 lines (1 loc) · 18.5 KB
/
Copy pathindex.html
File metadata and controls
1 lines (1 loc) · 18.5 KB
1
<!DOCTYPE html><html lang="en" ><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="theme" content="Chirpy v2.5.1"><meta name="generator" content="Jekyll v4.3.1" /><meta property="og:title" content="python4me" /><meta name="author" content="Guess who" /><meta property="og:locale" content="en_US" /><meta name="description" content="I’ll host python stuff here." /><meta property="og:description" content="I’ll host python stuff here." /><link rel="canonical" href="https://python4me.github.io/" /><meta property="og:url" content="https://python4me.github.io/" /><meta property="og:site_name" content="python4me" /><link rel="next" href="https://python4me.github.io/page2" /><meta name="twitter:card" content="summary" /><meta property="twitter:title" content="python4me" /><meta name="twitter:site" content="@" /><meta name="twitter:creator" content="@Guess who" /> <script type="application/ld+json"> {"description":"I’ll host python stuff here.","headline":"python4me","sameAs":[null,null],"@type":"WebSite","url":"https://python4me.github.io/","name":"Guess who","author":{"@type":"Person","name":"Guess who"},"@context":"https://schema.org"}</script><title>python4me</title><link rel="shortcut icon" href="/assets/img/favicons/favicon.ico" type="image/x-icon"><link rel="icon" href="/assets/img/favicons/favicon.ico" type="image/x-icon"><link rel="apple-touch-icon" href="/assets/img/favicons/apple-icon.png"><link rel="apple-touch-icon" href="/assets/img/favicons/apple-icon-precomposed.png"><link rel="apple-touch-icon" sizes="57x57" href="/assets/img/favicons/apple-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/assets/img/favicons/apple-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/assets/img/favicons/apple-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/assets/img/favicons/apple-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/assets/img/favicons/apple-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/assets/img/favicons/apple-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/assets/img/favicons/apple-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/assets/img/favicons/apple-icon-152x152.png"><link rel="apple-touch-icon" sizes="180x180" href="/assets/img/favicons/apple-icon-180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="/assets/img/favicons/android-icon-192x192.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="96x96" href="/assets/img/favicons/favicon-96x96.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicons/favicon-16x16.png"><link rel="manifest" href="/assets/img/favicons/manifest.json"><meta name='msapplication-config' content='/assets/img/favicons/browserconfig.xml'><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-TileImage" content="/assets/img/favicons/ms-icon-144x144.png"><meta name="theme-color" content="#ffffff"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"><link rel="dns-prefetch" href="https://fonts.gstatic.com"><link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials"><link rel="dns-prefetch" href="https://www.google-analytics.com"><link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="anonymous"><link rel="dns-prefetch" href="https://www.googletagmanager.com"><link rel="preconnect" href="cdn.jsdelivr.net"><link rel="dns-prefetch" href="cdn.jsdelivr.net"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css" integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" crossorigin="anonymous"><link rel="preload" href="/assets/css/home.css" as="style"><link rel="stylesheet" href="/assets/css/home.css"> <script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script> <script async src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script> <script async src="/assets/js/home.min.js"></script> <script defer src="/app.js"></script><body data-spy="scroll" data-target="#toc"><div id="sidebar" class="d-flex flex-column"><div id="nav-wrapper"><div id="profile-wrapper" class="d-flex flex-column"><div id="avatar" class="d-flex justify-content-center"> <a href="/" alt="avatar"> <img src="/assets/img/sample/avatar.png" alt="avatar" onerror="this.style.display='none'"> </a></div><div class="profile-text mt-3"><div class="site-title"> <a href="/">python4me</a></div><div class="site-subtitle font-italic"></div></div></div><ul class="nav flex-column"><li class="nav-item d-flex justify-content-center active"> <a href="/" class="nav-link d-flex justify-content-center align-items-center w-100"> <i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i> <span>HOME</span> </a><li class="nav-item d-flex justify-content-center "> <a href="/tabs/about/" class="nav-link d-flex justify-content-center align-items-center w-100"> <i class="fa-fw fas fa-info ml-xl-3 mr-xl-3 unloaded"></i> <span>ABOUT</span> </a><li class="nav-item d-flex justify-content-center "> <a href="/tabs/archives/" class="nav-link d-flex justify-content-center align-items-center w-100"> <i class="fa-fw fas fa-archive ml-xl-3 mr-xl-3 unloaded"></i> <span>ARCHIVES</span> </a><li class="nav-item d-flex justify-content-center "> <a href="/tabs/categories/" class="nav-link d-flex justify-content-center align-items-center w-100"> <i class="fa-fw fas fa-stream ml-xl-3 mr-xl-3 unloaded"></i> <span>CATEGORIES</span> </a><li class="nav-item d-flex justify-content-center "> <a href="/tabs/tags/" class="nav-link d-flex justify-content-center align-items-center w-100"> <i class="fa-fw fas fa-tags ml-xl-3 mr-xl-3 unloaded"></i> <span>TAGS</span> </a></ul></div><div class="sidebar-bottom d-flex flex-wrap justify-content-around mt-4"> <span id="mode-toggle-wrapper"> <i class="mode-toggle fas fa-sun" dark-mode-invisible></i> <i class="mode-toggle fas fa-moon" light-mode-invisible></i> <script type="text/javascript"> class ModeToggle { static get MODE_KEY() { return "mode"; } static get DARK_MODE() { return "dark"; } static get LIGHT_MODE() { return "light"; } constructor() { if (this.mode != null) { if (this.mode == ModeToggle.DARK_MODE) { if (!this.isSysDarkPrefer) { this.setDark(); } } else { if (this.isSysDarkPrefer) { this.setLight(); } } } var self = this; /* always follow the system prefers */ this.sysDarkPrefers.addListener(function() { if (self.mode != null) { if (self.mode == ModeToggle.DARK_MODE) { if (!self.isSysDarkPrefer) { self.setDark(); } } else { if (self.isSysDarkPrefer) { self.setLight(); } } self.clearMode(); } }); } /* constructor() */ setDark() { $('html').attr(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE); sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE); } setLight() { $('html').attr(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE); sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE); } clearMode() { $('html').removeAttr(ModeToggle.MODE_KEY); sessionStorage.removeItem(ModeToggle.MODE_KEY); } get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); } get isSysDarkPrefer() { return this.sysDarkPrefers.matches; } get isDarkMode() { return this.mode == ModeToggle.DARK_MODE; } get isLightMode() { return this.mode == ModeToggle.LIGHT_MODE; } get hasMode() { return this.mode != null; } get mode() { return sessionStorage.getItem(ModeToggle.MODE_KEY); } flipMode() { if (this.hasMode) { if (this.isSysDarkPrefer) { if (this.isLightMode) { this.clearMode(); } else { this.setLight(); } } else { if (this.isDarkMode) { this.clearMode(); } else { this.setDark(); } } } else { if (this.isSysDarkPrefer) { this.setLight(); } else { this.setDark(); } } } /* flipMode() */ } /* ModeToggle */ let toggle = new ModeToggle(); $(".mode-toggle").click(function() { toggle.flipMode(); }); </script> </span> <span class="icon-border"></span></div></div><div id="topbar-wrapper" class="row justify-content-center topbar-down"><div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between"> <span id="breadcrumb"> <span>Posts</span> </span> <i id="sidebar-trigger" class="fas fa-bars fa-fw"></i><div id="topbar-title"> python4me</div><i id="search-trigger" class="fas fa-search fa-fw"></i> <span id="search-wrapper" class="align-items-center"> <i class="fas fa-search fa-fw"></i> <input class="form-control" id="search-input" type="search" aria-label="search" placeholder="Search..."> <i class="fa fa-times-circle fa-fw" id="search-cleaner"></i> </span> <span id="search-cancel" >Cancel</span></div></div><div id="main-wrapper"><div id="main"><div class="row"><div class="col-12 col-lg-11 col-xl-8"><div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4"><div id="post-list"><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/lecture-four/">Lecture Notes 4</a></h1></div><div class="post-content"><p> A function, different to a mathematical one, is just a piece of code that only runs when it’s called and returns a value if desired. Modules We can just import our files from other files. Module...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Mon, Jan 16, 2023, 1:36 PM +0300" > Jan 16 <i class="unloaded">2023-01-16T13:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/lecture-five/">Lecture Notes 5</a></h1></div><div class="post-content"><p> # Raising forced exceptions x = 10 if x > 5: raise Exception('x should not exceed 5. The value of x was: {}'.format(x)) # assert import sys assert ('linux' in sys.platform), "This code runs...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Mon, Jan 16, 2023, 1:36 PM +0300" > Jan 16 <i class="unloaded">2023-01-16T13:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-solution-three/">Homework Solutions 3</a></h1></div><div class="post-content"><p></p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 19, 2020, 3:36 PM +0300" > Dec 19, 2020 <i class="unloaded">2020-12-19T15:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-three/">Homework 3</a></h1></div><div class="post-content"><p> Answers to all of these questions will be available at solutions 24 hours before the next lecture. 1 Make a function factorial(x) that will return x! (the factorial of x) >>> def factor...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 19, 2020, 2:36 PM +0300" > Dec 19, 2020 <i class="unloaded">2020-12-19T14:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/lecture-three/">Lecture Notes 3</a></h1></div><div class="post-content"><p> Input Here we’ll make use of the input() function (gasps). Example 1 >>> input() boo 'boo' Here you might notice that input() acted like the echo command in bash. To be honest, this i...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 19, 2020, 1:36 PM +0300" > Dec 19, 2020 <i class="unloaded">2020-12-19T13:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-solution-two/">Homework Solutions 2</a></h1></div><div class="post-content"><p> 1 We first need to figure out how to add letter from the start of a string to the end. For our first case let’s try taking the first letter of 'string' and sticking it to the end. Slice the strin...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 12, 2020, 3:36 PM +0300" > Dec 12, 2020 <i class="unloaded">2020-12-12T15:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-two/">Homework 2</a></h1></div><div class="post-content"><p> Answers to all of these questions will be available at solutions 24 hours before the next lecture. 1 Notice anything peculiar about “ikbal” and “kbali?” When we take the first letter of ikbal and...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 12, 2020, 2:36 PM +0300" > Dec 12, 2020 <i class="unloaded">2020-12-12T14:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/lecture-two/">Lecture Notes 2</a></h1></div><div class="post-content"><p> I have said we’d go into lists et al. in a later lecture and here we are. Iteration as its name is about iterating. You have an object with multiple (or just one) elements and you cycle over them (...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Sat, Dec 12, 2020, 1:36 PM +0300" > Dec 12, 2020 <i class="unloaded">2020-12-12T13:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-solution-one/">Homework Solutions 1</a></h1></div><div class="post-content"><p> Simple part The rules of the game OK let’s first think about how we can go about doing this. We have two separate arguments so we need to turn them into writing one-by-one. We...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Thu, Nov 26, 2020, 3:36 PM +0300" > Nov 26, 2020 <i class="unloaded">2020-11-26T15:36:00+03:00</i> </span></div></div><div class="post-preview"><div class="d-flex justify-content-between pr-xl-2"><h1><a href="/posts/homework-one/">Homework 1</a></h1></div><div class="post-content"><p> You should be able to do the easy part with your current knowledge while advanced will need you to do some research on your own (It’s related to next week’s subject). Answers to both of these quest...</p></div><div class="post-meta text-muted"> <i class="far fa-clock fa-fw"></i> <span class="timeago " data-toggle="tooltip" data-placement="bottom" title="Thu, Nov 26, 2020, 2:36 PM +0300" > Nov 26, 2020 <i class="unloaded">2020-11-26T14:36:00+03:00</i> </span></div></div></div><ul class="pagination mt-4 mb-0 pl-lg-2"><li class="page-item disabled"> <a class="page-link btn-box-shadow" href="#" aria-label="previous-page"> <i class="fas fa-angle-left"></i> </a><li class="page-item active"> <a class="page-link btn-box-shadow" href="/">1</a><li class="page-item "> <a class="page-link btn-box-shadow" href="/page2/">2</a><li class="page-item "> <a class="page-link btn-box-shadow" href="/page2" aria-label="next-page"> <i class="fas fa-angle-right"></i> </a></ul></div></div><div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down"><div class="access"><div id="access-lastmod" class="post"> <span>Recent Update</span><ul class="post-content pl-0 pb-1 ml-1 mt-2"><li><a href="/posts/lecture-four/">Lecture Notes 4</a><li><a href="/posts/lecture-three/">Lecture Notes 3</a><li><a href="/posts/homework-three/">Homework 3</a><li><a href="/posts/homework-solution-three/">Homework Solutions 3</a><li><a href="/posts/homework-solution-two/">Homework Solutions 2</a></ul></div><div id="access-tags"> <span>Trending Tags</span><div class="d-flex flex-wrap mt-3 mb-1 mr-3"> <a class="post-tag" href="/tags/lecture/">lecture</a> <a class="post-tag" href="/tags/homework/">homework</a> <a class="post-tag" href="/tags/solutions/">solutions</a></div></div></div></div></div><footer class="d-flex w-100 justify-content-center"><div class="d-flex justify-content-between align-items-center"><div class="footer-left"><p class="mb-0"> © 2023 <a href="">Guess who</a>. <span data-toggle="tooltip" data-placement="top" title="Except where otherwise noted, the blog posts on this site are licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.">Some rights reserved.</span></p></div></div></footer></div><div id="search-result-wrapper" class="d-flex justify-content-center unloaded"><div class="col-12 col-xl-11 post-content"><div id="search-hints"><h4 class="text-muted mb-4">Trending Tags</h4><a class="post-tag" href="/tags/lecture/">lecture</a> <a class="post-tag" href="/tags/homework/">homework</a> <a class="post-tag" href="/tags/solutions/">solutions</a></div><div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div></div></div></div><div id="mask"></div><a id="back-to-top" href="#" aria-label="back-to-top" class="btn btn-lg btn-box-shadow" role="button"> <i class="fas fa-angle-up"></i> </a> <script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js"></script> <script> SimpleJekyllSearch({ searchInput: document.getElementById('search-input'), resultsContainer: document.getElementById('search-results'), json: '/assets/js/data/search.json', searchResultTemplate: '<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0"> <a href="https://python4me.github.io{url}">{title}</a><div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1"><div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>{categories}</div><div><i class="fa fa-tag fa-fw"></i>{tags}</div></div><p>{snippet}</p></div>', noResultsText: '<p class="mt-5">Oops! No result founds.</p>' }); </script> <script async src="https://www.googletagmanager.com/gtag/js?id="></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', ''); </script>