{"id":30592,"date":"2016-02-09T09:44:25","date_gmt":"2016-02-09T15:44:25","guid":{"rendered":"http:\/\/esenombredeusua.wordpress.com\/?p=243"},"modified":"2016-02-09T10:29:36","modified_gmt":"2016-02-09T16:29:36","slug":"quiz01-defining-and-testing","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/quiz01-defining-and-testing\/","title":{"rendered":"Quiz01 \u2013 Defining and Testing"},"content":{"rendered":"<p style=\"text-align:justify;\"><span style=\"color:#000000;\">First quiz, and as I had no computer to work with, I answered it on paper. The first step was to create a python file named prog1.py that contains a function that has a cylinder&#8217;s radius and a height as parameters and outputs the cylinder&#8217;s volume. Now let&#8217;s test what I did:<\/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;-<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-245\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/efd48a02b6c55474507b5577135a207b.jpg#038;h=72\" alt=\"Screen Shot 2016-02-09 at 8.59.09 AM\" width=\"684\" height=\"72\" \/><\/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;-<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">There&#8217;s the function, but that&#8217;s just the beginning, let&#8217;s test it, of course :<\/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;-<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Editor :\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-282\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/9f28fe1d9c9a863cc4527c419d54609f.jpg#038;h=123\" alt=\"Screen Shot 2016-02-09 at 9.25.32 AM\" width=\"687\" height=\"123\" \/><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Terminal :\u00a0<\/span><\/p>\n<p style=\"text-align:justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-297\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/60f5aa59ede9985edcb1e662c0e8a21f.jpg#038;h=52\" alt=\"Screen Shot 2016-02-09 at 9.33.35 AM\" width=\"684\" height=\"52\" \/><\/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;-<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">To prove my answer as correct I \u00a0called my function with <span style=\"color:#00ff00;\">a<\/span> and <span style=\"color:#00ff00;\">b<\/span> as parameters, when <span style=\"color:#00ff00;\">a <\/span>and <span style=\"color:#00ff00;\">b <\/span>are inputs by the user, raw_input returns data as strings, that&#8217;s why I call <span style=\"color:#ff00ff;\">float<\/span> on it. Here I am using python 2.7.11, if you are using python 3 you&#8217;d have to change <span style=\"color:#ff00ff;\">raw_input<\/span> for <span style=\"color:#ff00ff;\">input<\/span> and add parentheses when calling print on volume: <span style=\"color:#ff00ff;\">print<\/span>(<span style=\"color:#33cccc;\">volume<\/span>(<span style=\"color:#00ff00;\">a<\/span>, <span style=\"color:#00ff00;\">b<\/span>)).<\/span><\/p>\n<p style=\"text-align:justify;\"><span style=\"color:#000000;\">Next is the second part. As expected, the new python file is named prog2.py, it should ask for two numbers and return their product, their integer division, and the remainder from their division. This is what I turned in :\u00a0<\/span><\/p>\n<p><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;-<\/span><\/p>\n<p><span style=\"color:#000000;\">Editor :\u00a0<\/span><\/p>\n<p><span style=\"color:#000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-295\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/b0aaff4c12e393e90a51bb5e116aafea.jpg#038;h=119\" alt=\"Screen Shot 2016-02-09 at 9.32.40 AM\" width=\"677\" height=\"119\" \/><\/span><\/p>\n<p><span style=\"color:#000000;\">Terminal :\u00a0<\/span><\/p>\n<p><span style=\"color:#000000;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-293\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/00bdb5ab3b629b3932bcae2069eb25f7.jpg#038;h=59\" alt=\"Screen Shot 2016-02-09 at 9.31.46 AM\" width=\"688\" height=\"59\" \/><\/span><\/p>\n<p><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;-<\/span><\/p>\n<p><span style=\"color:#000000;\">This second part didn&#8217;t ask to use float numbers, but integers, thus <span style=\"color:#ff00ff;\">int<\/span> is called on the input. It wasn&#8217;t necessary to edit this any further to prove the answer correct, as it proves itself.<\/span><\/p>\n<p><span style=\"color:#000000;\">This is my post for the first quiz on my Programming Fundamentals course.<\/span><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/esenombredeusua.wordpress.com\/243\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/d47c8da244659235190a72323ce211ed.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/795880c1f2fdc442dc13712044940b6c.jpg#038;blog=105323064&#038;%23038;post=243&#038;%23038;subd=esenombredeusua&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First quiz, and as I had no computer to work with, I answered it on paper. The first step was to create a python file named prog1.py that contains a function that has a cylinder&#8217;s radius and a height as parameters and outputs the cylinder&#8217;s volume. Now let&#8217;s test what I did: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- There&#8217;s &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/quiz01-defining-and-testing\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Quiz01 \u2013 Defining and Testing<\/span><\/a><\/p>\n","protected":false},"author":65,"featured_media":30595,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[121,45],"class_list":["post-30592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-quiz1","tag-sin-categoria"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30592","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=30592"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30592\/revisions"}],"predecessor-version":[{"id":30608,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30592\/revisions\/30608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/30595"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=30592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=30592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=30592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}