{"id":36191,"date":"2016-04-15T07:44:35","date_gmt":"2016-04-15T12:44:35","guid":{"rendered":"http:\/\/kenscourses.com\/tc101winter2016\/?p=36191"},"modified":"2016-04-15T07:44:35","modified_gmt":"2016-04-15T12:44:35","slug":"quiz-07","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/04\/quiz-07\/","title":{"rendered":"Quiz 07"},"content":{"rendered":"<h2>Weekly Quiz<\/h2>\n<p>Write your code for the quiz, then:<\/p>\n<ul>\n<li>email your answers (as file attachments) to Ken.<\/li>\n<li>Most important: blog about your answers. You should explain the code, your process and link to code on GitHub.<\/li>\n<\/ul>\n<h2>The Quiz (same for both C++\/Python)<\/h2>\n<p><!--more-->In mathematics, the dot product, or scalar product (or sometimes inner product in the<br \/>\ncontext of Euclidean space), is an algebraic operation that takes two equal-length<br \/>\nsequences of numbers (usually coordinate vectors) and returns a single number.<\/p>\n<p>Algebraically, it is the sum of the products of the corresponding entries of the two<br \/>\nsequences of numbers<\/p>\n<h2>What to Do<\/h2>\n<p>Create a function called dot_product that receives two lists of numbers (say list1 and<br \/>\nlist2). The function returns what is the dot product of the two lists.<\/p>\n<p>For full marks, if the lists are not the same size, then the function should return the<br \/>\nspecial value of NaN (which represents not a number).<\/p>\n<ul>\n<li>For Python, you can create this value with the\u00a0expression: float(&#8216;NaN&#8217;)<\/li>\n<li>For C++, check here:\u00a0http:\/\/www.cplusplus.com\/reference\/cmath\/nan-function\/<\/li>\n<\/ul>\n<p>Example. If the input is [2,4,5,6] and [1,2,3,4] the result will be 49 since\u00a0(2*1)+(4*2)+(5*3)+(6*4) = 49<\/p>\n<h2>Get Creative, put style in your Blog Posts<\/h2>\n<p>Make the posts your expression, be good internet citizens but also have fun!<\/p>\n<figure id=\"attachment_36192\" aria-describedby=\"caption-attachment-36192\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.flickr.com\/photos\/nerina\/268955686\/\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-36192\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/268955686_ac86594e30_z.jpg\" alt=\"flickr photo by Kaboedel https:\/\/flickr.com\/photos\/nerina\/268955686 shared under a Creative Commons (BY-NC) license\" width=\"500\" height=\"304\" srcset=\"https:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/268955686_ac86594e30_z.jpg 500w, https:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/268955686_ac86594e30_z-300x182.jpg 300w, https:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/268955686_ac86594e30_z-178x108.jpg 178w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-36192\" class=\"wp-caption-text\">flickr photo by Kaboedel https:\/\/flickr.com\/photos\/nerina\/268955686 shared under a Creative Commons (BY-NC) license<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Weekly Quiz Write your code for the quiz, then: email your answers (as file attachments) to Ken. Most important: blog about your answers. You should explain the code, your process and link to code on GitHub. The Quiz (same for both C++\/Python)<\/p>\n","protected":false},"author":2,"featured_media":36192,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,154],"tags":[],"class_list":["post-36191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-instructor","category-quizzes"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/36191","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=36191"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/36191\/revisions"}],"predecessor-version":[{"id":36193,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/36191\/revisions\/36193"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/36192"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=36191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=36191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=36191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}