{"id":31413,"date":"2016-02-15T15:20:47","date_gmt":"2016-02-15T21:20:47","guid":{"rendered":"http:\/\/esenombredeusua.wordpress.com\/?p=816"},"modified":"2016-02-15T16:21:35","modified_gmt":"2016-02-15T22:21:35","slug":"quiz2-2","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/quiz2-2\/","title":{"rendered":"#Quiz2"},"content":{"rendered":"<p style=\"text-align:justify;\"><span style=\"color:#000000;\">I had this quiz quite some time ago, it was about time I wrote about this.\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Well, first of all, what the quiz asks us to do is create a file and write down a function called &#8220;superpower&#8221;. It should accept two parameters and return the value of first parameter elevated to the power of the second parameter, for example, superpower(a, b) should return the value of a^b power. This was my answer :<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Editor :<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-831\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/77a272366dfb08306cf3cd18578a8386.jpg\" alt=\"Screen Shot 2016-02-15 at 10.44.54 AM\"   \/><\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Terminal :<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-833\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/4b0ea2c89ad83b6badff18e4a3879725.jpg#038;h=71\" alt=\"Screen Shot 2016-02-15 at 10.45.09 AM\" width=\"705\" height=\"71\" \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">There. So the code works perfectly, maybe we could add some user-friendliness with some more strings.\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Editor :<\/span><\/p>\n<p style=\"text-align:justify;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-846\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/6d6777e57ba2f43e6302659b321dea08.jpg\" alt=\"Screen Shot 2016-02-15 at 10.55.06 AM\"   \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Terminal :<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-843\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/b2b36d99bf78c317e6428841ae8f0dc2.jpg#038;h=151\" alt=\"Screen Shot 2016-02-15 at 10.54.13 AM\" width=\"678\" height=\"151\" \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Nice going.<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">The next part of the quiz is to write a function called stars that accepts one parameter and prints as many stars in the same line. For example, stars(3) should print &#8220;***&#8221;, and stars(9) should print &#8220;*********&#8221; .\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">This was my answer :<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Editor :<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-860\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/5f16dc420662d1376c6defefce3cd181.jpg\" alt=\"Screen Shot 2016-02-15 at 11.04.30 AM\"   \/><\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Terminal :<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-864\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/7e4fe5f937b9bd82284fd7d5d2428d52.jpg#038;h=35\" alt=\"Screen Shot 2016-02-15 at 11.05.27 AM\" width=\"687\" height=\"35\" \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Done, right? The stars are printed in the same line because of the comma after the string. That should be enough. Not quite, the stars are printed, but the comma causes a space between each star. After thinking about this for a little, I figured we could append each star on a list and\u00a0<span style=\"color:#ff00ff;\">join <span style=\"color:#000000;\">them, but actually it&#8217;s easier to <span style=\"color:#ff00ff;\">join<\/span> them as it is, as a string. Talking about easier solutions, now that I think about it, multiplying the string would be way easier:<\/span><\/span><\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Editor :<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\"><span style=\"color:#ff00ff;\"><span style=\"color:#000000;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-878\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/74e5e1644fcb22c915ff6c283c3e1d8f.jpg\" alt=\"Screen Shot 2016-02-15 at 3.04.49 PM\"   \/>\u00a0<\/span><\/span><\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Terminal :<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-882\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/83a2ebe63f928143f3f07c6a0dd3597f.jpg#038;h=37\" alt=\"Screen Shot 2016-02-15 at 3.06.06 PM\" width=\"679\" height=\"37\" \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-884\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/86749470d2348266aa08d141637eb95d.jpg#038;h=35\" alt=\"Screen Shot 2016-02-15 at 3.06.22 PM\" width=\"689\" height=\"35\" \/><\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Yes, it works. Well, there must be\u00a0more ways of doing this but I don&#8217;t think the solution can get any easier, so&#8230; I&#8217;m leaving this up to here.\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">This is my post for the\u00a0#quiz2\u00a0on my Programming Fundamentals course.<\/span><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/esenombredeusua.wordpress.com\/816\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/b521b00a3b30cb8684fc3de291067a18.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/636fa9b184885fa0171ba8e3b7e6085e.jpg#038;blog=105323064&#038;%23038;post=816&#038;%23038;subd=esenombredeusua&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had this quiz quite some time ago, it was about time I wrote about this.\u00a0 Well, first of all, what the quiz asks us to do is create a file and write down a function called &#8220;superpower&#8221;. It should accept two parameters and return the value of first parameter elevated to the power of &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/quiz2-2\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">#Quiz2<\/span><\/a><\/p>\n","protected":false},"author":65,"featured_media":31416,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[136],"class_list":["post-31413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-quiz2"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/31413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=31413"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/31413\/revisions"}],"predecessor-version":[{"id":31437,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/31413\/revisions\/31437"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/31416"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=31413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=31413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=31413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}