{"id":88,"date":"2019-10-05T17:48:37","date_gmt":"2019-10-05T17:48:37","guid":{"rendered":"https:\/\/www.beens.ca\/python\/?p=88"},"modified":"2019-10-08T13:41:01","modified_gmt":"2019-10-08T13:41:01","slug":"day-5-learning-summary-for-100daysofcode","status":"publish","type":"post","link":"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/","title":{"rendered":"Day 5 Learning Summary for #100DaysOfCode"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f2dbbe51cf9\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f2dbbe51cf9\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/#Goals_for_Today\">Goals for Today<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/#What_I_Learned\">What I Learned<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/#Blog_CSS\">Blog CSS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/#Auto-formatting_Python_in_VS_Code\">Auto-formatting Python in VS Code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/#List_Comprehension\">List Comprehension<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<h2><span class=\"ez-toc-section\" id=\"Goals_for_Today\"><\/span>Goals for Today<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>I still want to do more list comprehension exercises. Hopefully I can find some that are more advanced. <a href=\"https:\/\/www.google.com\/search?hl=en&amp;as_q=list+comprehension++python&amp;as_epq=&amp;as_oq=challenges+exercises\" target=\"_blank\" rel=\"noopener noreferrer\">Google<\/a>\u00a0is my friend, hopefully.<\/p>\n<p>I want to figure out how to get VS Code to auto-format my Python code.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_I_Learned\"><\/span>What I Learned<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><!--more--><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Blog_CSS\"><\/span>Blog CSS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>I got a little distracted today playing with the CSS on my blog. Headers had too much spacing around them. With some research, I added this CSS to the appearance section of my WordPress blog:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large\" src=\"https:\/\/lh3.googleusercontent.com\/5XFumtGFkjRd4GgWmxg85wqDTkdKA9VTVH7Aow4FcLMfuhkDFGhGoPNCkvZCTMmugdmBcps6J5_v4GWeOgv0XjfpmeGQ1-qKbqvfUb2XiWp8ImbmE-8SzrzNpyd1Tr2Z3VE8uwr5a6PXQCKGkclERi3EIyAzJ4JZKHDJnq27GlCvK38iTuQW4dMy4rq2FEjhKTMNUY4YiQAvdpwTu5ihADymLhjaRDa_2RX7wJrvNPeBDy7luXz_wAwZeytp5mym0rIBBOZtUalnARyuR40Ja29otLZvl6Oni98RRAmWR2zA_jJuTHQtH5pjEqa92c85NjiUiOwJrp9bN4HwK9BMXKD_XMPoFib3H739gVRIsgzFHsdRSPyEOIsYaXoiET3i8_Npm8VuzF-2mLm89uhVoG-8MuSaR0wmoUCPTkyNRT6Y1TRPKgMJ7iviT1Gitc7wKjRI-iBaaU2pgfo2kM5f-F2izsq-yr9XP3_c3AfkwEHhl29nNR918TiUEAyFuPO-mxDg2OU1M7L6eW1hI-vMcRWAL48Gw4tziQnGm-zj3dO7Ccj9w-0iWUr0PDPJ_qR8AVA-LrGqYV3ngdhk312MPRlN8PCZvLgFPClxVzyZbAkOEB5YCayaDnOnATTIy1GE8sDEGxZOa-QWmdeP94zefD5U-XlhlResz-9rGJENkx9Zw0g-LeJ3u83Y=w267-h411-no\" alt=\"CSS\" width=\"267\" height=\"411\" \/><\/p>\n<p>Summary: My CSS knowledge is very limited. Fortunately there are lots of great resources available to help when needed.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Auto-formatting_Python_in_VS_Code\"><\/span>Auto-formatting Python in VS Code<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This wasn&#8217;t on my goal list for today but it was frustrating me that I couldn&#8217;t auto-format my Python code like could in PyCharm.<\/p>\n<p>The solution was found\u00a0<a href=\"https:\/\/donjayamanne.github.io\/pythonVSCodeDocs\/docs\/formatting\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>These are the settings I changed to get VS Code to auto-format my Python code:<\/p>\n<pre>\"editor.formatOnSave\": true`\r\n\"python.formatting.provider\": \"autopep8\"<\/pre>\n<p>Summary: I continue to be impressed with VS Code, particularly all the options available in it.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"List_Comprehension\"><\/span>List Comprehension<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>I came across this great animation that is perfect for demonstrating how list comprehensions are assembled:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"92\" data-permalink=\"https:\/\/www.beens.ca\/python\/2019\/10\/05\/day-5-learning-summary-for-100daysofcode\/list-comprehension-condition\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.beens.ca\/python\/wp-content\/uploads\/sites\/4\/2019\/10\/list-comprehension-condition.gif?fit=500%2C150&amp;ssl=1\" data-orig-size=\"500,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"list-comprehension-condition\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.beens.ca\/python\/wp-content\/uploads\/sites\/4\/2019\/10\/list-comprehension-condition.gif?fit=500%2C150&amp;ssl=1\" class=\"alignnone size-full wp-image-92\" src=\"https:\/\/i0.wp.com\/www.beens.ca\/python\/wp-content\/uploads\/sites\/4\/2019\/10\/list-comprehension-condition.gif?resize=500%2C150&#038;ssl=1\" alt=\"list-comprehension-condition\" width=\"500\" height=\"150\" \/><br \/>\n[<a href=\"https:\/\/treyhunner.com\/2015\/12\/python-list-comprehensions-now-in-color\/\" rel=\"nofollow noopener\" target=\"_blank\">Credit<\/a>]<\/p>\n<p>This site helped me tremendously with flattening and recreating matrices:<\/p>\n<ul>\n<li><a href=\"https:\/\/treyhunner.com\/2015\/12\/python-list-comprehensions-now-in-color\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python List Comprehensions: Explained Visually &#8211; Trey Hunner<\/a><\/li>\n<\/ul>\n<p>This site helped me add the individual elements of each list:<\/p>\n<ul>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/16568056\/nested-list-comprehension-with-two-lists\" target=\"_blank\" rel=\"noopener noreferrer\">Nested list comprehension with two lists<\/a><\/li>\n<\/ul>\n<p>With these resources I was able to make great progress on my Day 2 challenge but it&#8217;s not quite finished yet. It will add matrices with sub-lists of len=2 but not others. I&#8217;ll work on that next day&#8230;<\/p>\n<p>View my updated Jupyter notebook of exercises <a href=\"https:\/\/colab.research.google.com\/drive\/1fbmH9yDS5fzFcxEZMnUzmb3qCqGQoaEv\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. See the Resource 2 section for the code applicable to what I did today.<\/p>\n<p>View my Python code for the Day 2 challenge <a href=\"https:\/\/github.com\/pbeens\/100DaysOfCode\/blob\/master\/Days\/02\/add.py\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> in the Day 2 folder. Remember, as of today, it&#8217;s incomplete.<\/p>\n<p><code><\/code><\/p>\n<hr \/>\n<div dir=\"auto\" lang=\"en\">You can see this project on GitHub <a href=\"https:\/\/github.com\/pbeens\/100DaysOfCode\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/div>\n<p>&nbsp;<\/p>\n<div dir=\"auto\" lang=\"en\" style=\"text-align: center;\"><em>Please consider subscribing to this blog!\u00a0<\/em><\/div>\n<div id=\"tweet-rich-content-label\" class=\"css-1dbjc4n r-156q2ks\" aria-labelledby=\"quote-tweet-label\">\n<div class=\"css-1dbjc4n\">\n<div class=\"css-1dbjc4n r-1cuuowz r-18bvks7 r-t23y2h r-1phboty r-rs99b7 r-18u37iz r-1udh08x r-o7ynqc r-1j63xyz\" aria-haspopup=\"false\">\n<div class=\"css-1dbjc4n r-18bvks7 r-13l2t4g r-1phboty r-1adg3ll\" aria-hidden=\"true\">\n<div class=\"css-1dbjc4n r-1adg3ll r-1udh08x\">\n<div class=\"r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu\">\n<div class=\"css-1dbjc4n r-1p0dtai r-1mlwlqe r-1d2f490 r-11wrixw r-61z16t r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010\">\n<div class=\"css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Goals for Today I still want to do more list comprehension exercises. Hopefully I can find some that are more advanced. Google\u00a0is my friend, hopefully. I want to figure out how to get VS Code to auto-format my Python code. What I Learned<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"footnotes":""},"categories":[11,10],"tags":[12,21,13,24,22,20,7],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-100daysofcode","category-github","tag-100daysofcode","tag-colaboratory","tag-github","tag-github-pages","tag-google-colab","tag-list-comprehension","tag-python"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paaL4r-1q","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":5,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":99,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/posts\/88\/revisions\/99"}],"wp:attachment":[{"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beens.ca\/python\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}