{"id":3800,"date":"2024-02-02T02:07:00","date_gmt":"2024-02-02T07:07:00","guid":{"rendered":"https:\/\/www.both.org\/?p=3800"},"modified":"2024-01-24T16:08:21","modified_gmt":"2024-01-24T21:08:21","slug":"how-i-teach-python-with-open-source-tools","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=3800","title":{"rendered":"How I teach Python with open source tools"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"3800\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p class=\"wp-block-paragraph\">I love to teach Python. I start by beginning where the learner begins. My first question is, &#8220;How would you like to learn Python?&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They usually answer, &#8220;What&#8217;s Python?&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s when I give them some examples of websites built with Python they might already be familiar with. I also provide examples of using Python in data science, engineering and web development.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most folks are intimidated when you try to introduce computer programming because their first efforts failed or someone told them programming is difficult. I show them a simple print statement that easily demonstrates how much the Python syntax is like the language they speak.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; print(\"Hello World\")\nHello World<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Unless they are Linux or macOS users, they might need help installing Python on their computer. I guide them through downloading Python from the <a href=\"https:\/\/www.python.org\/\">Python.org<\/a> website and installing it on their computer. Next, I help them set up a development environment. For many users this is <a href=\"https:\/\/opensource.com\/article\/17\/10\/python-101\">IDLE<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a-good-python-ide\">A good Python IDE<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For a young student, I introduce <a href=\"https:\/\/codewith.mu\/\">Mu<\/a>, a great development environment for elementary and middle school students. Adults and older students might use <a href=\"https:\/\/vscodium.com\/\">VSCodium<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"python-repl\">Python REPL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I often introduce new users to the <a href=\"https:\/\/codewith.mu\/en\/tutorials\/1.2\/repl\">REPL<\/a> so they can execute their code easily. Then I show them how to write a simple program with a print statement <code>print(\"Hello World\")<\/code> and save it as a text file with a <code>.py<\/code> extension. I explain that the <code>.py<\/code> extension is necessary for Python to recognize the program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"turtle\">Turtle<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Then, I introduce them to Python fundamentals, including variables, strings, numbers, and basic operations. I suggest Python libraries like the <a href=\"https:\/\/opensource.com\/life\/15\/8\/python-turtle-graphics\">Turtle<\/a>, which even adults find fascinating. I start simply in the REPL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import turtle  \nturtle.forward(100)\nturtle.right(90)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This example demonstrates how easy it is to write code in Python and how just a few lines can produce a graphic on their display. Then I show how to draw a square:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import turtle\nturtle.forward(100)\nturtle.right(90)\nturtle.forward(100)\nturtle.right(90)\nturtle.forward(100)\nturtle.right(90)\nturtle.forward(100)\nturtle.right(90)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then I cover control structures like the <strong>if<\/strong> statement, <strong>elif<\/strong>, <strong>for<\/strong>, and <strong>while<\/strong>. I demonstrate drawing that same square quickly and easily with a <strong>for<\/strong> loop:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import turtle\nfor x in range(4):\n    turtle.forward(100)\n    turtle.right(90)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"teaching-python-is-a-gift\">Teaching Python is a gift<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When you teach, it&#8217;s important to begin where the learner is and engage them in their own edification. This approach has them leaning in for more information, ensuring they gain skill and competency.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your local public library might be a great place to find students who want to learn Python. Most libraries would happily have you volunteer to help their patrons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open source tools can be used to help new programmers learn Python.<\/p>\n","protected":false},"author":32,"featured_media":3803,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[150,238],"tags":[152],"class_list":["post-3800","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-python","tag-programming"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3800"}],"version-history":[{"count":2,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3800\/revisions"}],"predecessor-version":[{"id":3804,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/3800\/revisions\/3804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3803"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}