{"id":505,"date":"2013-04-24T10:44:20","date_gmt":"2013-04-24T18:44:20","guid":{"rendered":"https:\/\/sheldon-hess.org\/coral\/?p=505"},"modified":"2013-04-24T10:44:58","modified_gmt":"2013-04-24T18:44:58","slug":"python-week-1","status":"publish","type":"post","link":"https:\/\/www.sheldon-hess.org\/coral\/2013\/04\/python-week-1\/","title":{"rendered":"Intro to Python &#8211; Week 1 &#8211; Musings"},"content":{"rendered":"<p><strong>About class (and teaching\/learning programming):<\/strong><\/p>\n<p>In Week 1 we covered functions, the modulo operator, comparisons, and if\/elif\/else. They offer a tool called &#8220;<a href=\"http:\/\/www.codeskulptor.org\/demos.html\">Pystep<\/a>,&#8221; where you can see functions being evaluated. I am not sure whether it is actually more helpful or more confusing to someone who is unfamiliar with programming, but it&#8217;s a cool idea and another way to try to visualize what&#8217;s going on. Similarly, they talked about functions in terms of &#8220;black boxes.&#8221; As an engineer, that&#8217;s super intuitive to me, but I find myself really curious about whether that made sense to anyone who&#8217;s new to programming. I do remember finding truth tables really confusing when I was in school, and I looked away while he was going through them in this class&mdash;I think it&#8217;s related to my (mild!) dyslexia. I evaluate complex Boolean statements really well, but I don&#8217;t do it with tables. I wonder if truth tables make sense to most people, though.<\/p>\n<p>Honestly, I&#8217;m thinking I&#8217;d start a group of librarians with True\/False and comparators, before I even went into the other operators. Librarians are pretty familiar with Boolean logic&mdash;something that the newbies who are non-librarians might have some trouble with, at first&mdash;but, for a librarian, that part should feel like home and should help build up some early confidence. <\/p>\n<p>I wonder how non-librarians who haven&#8217;t programmed before felt about the quick intro to comparators. It was &#8230; speedy. <\/p>\n<p>Anyway, back to class: the assignment was to build Rock-Paper-Scissors-Lizard-Spock. I was kind of sleepy, which always makes my dyslexia worse, so once I had it written, it was a little hard to evaluate whether I got it right or not. I dread doing the peer evaluations for that reason. But it was a pretty good, simple starting project&mdash;assuming you caught the part of the lecture where he told you how to do the clever modulo trick. (You assign a number to each one, when they&#8217;re arranged in a certain order. Then, to determine who wins, you take the difference modulo 5. If it&#8217;s 1 or 2, it&#8217;s a win; if it&#8217;s 3 or 4, it&#8217;s a loss. &#8212; I&#8217;m not breaking the honor code by saying this here; I&#8217;m quoting the professor nearly word-for-word. I know because I had to go back and watch that part of the lecture again.) Honestly, my plan when I heard about this assignment was to power through a bunch of if\/elif\/else statements. I would never have come up with the modulo thing on my own, and although I&#8217;m prepared to blame sleepiness\/dyslexia for it and assume it would have made sense on a different day, I&#8217;ll come clean and admit that I barely understood why it worked. I just did as I was told and made sure everything evaluated appropriately. <\/p>\n<p>Once again, the quiz was unnecessarily mathy. &#8220;Build functions,&#8221; (great, yes!) &#8220;out of these equations&#8221; (REALLY?). Is that necessary? One equation-question might have been OK, but there were three. Why not string operations? Grr. <\/p>\n<p>Now that I&#8217;m writing this, I have to say, I feel a little &#8230; paternalistic? &#8230; complaining about the math on others&#8217; behalf. I don&#8217;t know for certain that anyone found programming equations particularly daunting. It just seems like there might be a more approachable way to assess people&#8217;s understanding of the programming concepts, given that math-phobia is fairly common and <a href=\"http:\/\/scholar.google.com\/scholar?q=math+anxiety\" title=\"Google Scholar search - math anxiety\">well documented<\/a>. Maybe I&#8217;m focusing on this too much, though.<\/p>\n<p><strong>About Python itself:<\/strong><\/p>\n<p>One project in, I am starting to understand why people like Python. At first, it was pretty weird trying to program without braces (I always call them &#8220;brackets,&#8221; for some reason) or semi-colons. But the code reads a lot like English. It&#8217;s just&#8230; super neat. I&#8217;ve never gotten joy from a programming language before&mdash;a job well done, despite the language, or a clever solution to a problem, sure, of course, but never the <em>language<\/em> itself. It&#8217;s pretty amazing.<\/p>\n<p>My only complaint so far is &#8220;Why elif? Why not else if, or elseif?&#8221; Well, and perhaps Python&#8217;s unnecessary respect for programming history, in (apparently?) usually counting zero to n-1, instead of zero to n. (For Python aficionados who will have more perspective than I do, here&#8217;s where this comes from: somewhere in his assignment or documentation or somewhere, the professor claimed that that doing ranges the way random.randrange() does (x &lt;= N <strong>&lt;<\/strong> y) is more common in Python than doing x &lt;= N <strong>&lt;=<\/strong> y, like random.randint() does.) It won&#8217;t cause me any future problems, because the zero to n-1 pattern is internalized for me, but it&#8217;s a weird choice for an otherwise readable language. I nearly turned in the assignment with an off-by-one error, because I was floating on a Python cloud and assumed it would handle things intuitively for a non-programmer. To be fair, I suppose that&#8217;s on me, not on the language.<\/p>\n<p>So now I find myself wondering&#8230; can people get paid for writing in Python? :) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>About class (and teaching\/learning programming): In Week 1 we covered functions, the modulo operator, comparisons, and if\/elif\/else. They offer a tool called &#8220;Pystep,&#8221; where you can see functions being evaluated. I am not sure whether it is actually more helpful or more confusing to someone who is unfamiliar with programming,&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.sheldon-hess.org\/coral\/2013\/04\/python-week-1\/\">Continue reading<span class=\"screen-reader-text\">Intro to Python &#8211; Week 1 &#8211; Musings<\/span><\/a><\/div>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,53,70,38],"tags":[],"class_list":["post-505","post","type-post","status-publish","format-standard","hentry","category-classes","category-geekery","category-programming","category-technology","entry"],"_links":{"self":[{"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/posts\/505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/comments?post=505"}],"version-history":[{"count":0,"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/posts\/505\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/media?parent=505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/categories?post=505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheldon-hess.org\/coral\/wp-json\/wp\/v2\/tags?post=505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}