{"id":37327,"date":"2016-05-04T21:12:36","date_gmt":"2016-05-05T02:12:36","guid":{"rendered":"http:\/\/andreatrejod.wordpress.com\/?p=370"},"modified":"2016-05-04T21:21:44","modified_gmt":"2016-05-05T02:21:44","slug":"quiz7-3","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/05\/quiz7-3\/","title":{"rendered":"Quiz#7"},"content":{"rendered":"<h2>The last quiz finally!!!!<\/h2>\n<h2>The Quiz<\/h2>\n<p><span id=\"more-36191\"><\/span>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(\u2018NaN\u2019)<\/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<p>So this was me trying to do this quiz<\/p>\n<p>**Thanks to this program we can make the product of two lists, it&#8217;s very simple, you only multiply each number of the list one by one, but as always in life, there&#8217;s one exception, if the size of the list is not equal, then you can&#8217;t make the product of the lists, so we have to make a conditional that makes sure to compare the size of the lists and it tells you if there are equals or not, to know the size of the list we can use <strong>len<\/strong>.<\/p>\n<p>So here&#8217;s the screenshot of the program<\/p>\n<p>And the link in\u00a0<a href=\"https:\/\/github.com\/andreatrejod\/TC101\/blob\/master\/quiz7.py\">GitHub<\/a><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-386\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/2a3bb6f3a18a737bde6c269786b83d9f.jpg\" alt=\"quiz7\"   \/><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/andreatrejod.wordpress.com\/370\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/e035eeb1c15bfa1b121e2ababd8041ef.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/7af10aa7643626dce3c16bd14def20dc.jpg#038;blog=97425938&#038;%23038;post=370&#038;%23038;subd=andreatrejod&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last quiz finally!!!! The Quiz In mathematics, the dot product, or scalar product (or sometimes inner product in the context of Euclidean space), is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number. Algebraically, it is the sum of the products of the corresponding entries &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/05\/quiz7-3\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Quiz#7<\/span><\/a><\/p>\n","protected":false},"author":73,"featured_media":37355,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[45],"class_list":["post-37327","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-sin-categoria"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/37327","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\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=37327"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/37327\/revisions"}],"predecessor-version":[{"id":37359,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/37327\/revisions\/37359"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/37355"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=37327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=37327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=37327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}