{"id":38821,"date":"2016-10-29T00:40:06","date_gmt":"2016-10-29T05:40:06","guid":{"rendered":"http:\/\/firstprogrammingsteps.wordpress.com\/?p=336"},"modified":"2016-10-29T00:40:06","modified_gmt":"2016-10-29T05:40:06","slug":"lists-and-tuples-3","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/lists-and-tuples-3\/","title":{"rendered":"Lists and Tuples"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/firstprogrammingsteps.wordpress.com\/2016\/10\/29\/lists-and-tuples\/\"><a href=\"https:\/\/firstprogrammingsteps.wordpress.com\">Hackerman&amp;#039;s house<\/a><\/a><\/em><br \/><\/p>\n<p><img class=\"alignnone  wp-image-356 aligncenter\" src=\"https:\/\/firstprogrammingsteps.files.wordpress.com\/2016\/10\/chema.jpg?w=145&#038;h=152\" alt=\"chema\" width=\"145\" height=\"152\" \/><\/p>\n<p>I review this topic with my good friend Sebastian Cede\u00f1o, we read a lot about this topic and made this really cool post. So bad that I had to finish it and upload it, so im doing this really late in friday night. There is a little bit of regreat in this words, but i&#8217;m also happy that I could finish this partial just as planned. Also check out Cheba&#8217;s blog: <a href=\"https:\/\/chebasquared.wordpress.com\/\" rel=\"nofollow\">https:\/\/chebasquared.wordpress.com\/<\/a><\/p>\n<p>Lists and Tuples are sequenced types of data so called because they behave like a sequence.\u00a0 This type of data is different than the numeric data because they are made of smaller elements that are put together. The elements that are inside a List or a Tuple can be almost any type of data, like a string, a numeric value even another list or tuple.<\/p>\n<p>Define a list is really simple. Its similar to a string just that in this case we dont use &#8221;, we use\u00a0 square brackets. []<\/p>\n<blockquote><p>ListExample = [2, &#8220;Chema &#8220;, 3, &#8220;Paco &#8220;, (&#8220;Perro&#8221;, &#8220;Gato&#8221;)]<\/p><\/blockquote>\n<p>A tuple is almost the same as a list, the main difference between this two is that a list can be updated and modified, and a tuple cant be moddified once it has been defined. This means that the original values that are inside a Tuple will be there forever. Also the way that they are defined is a little bit different. While lists use square brackets, Tuples use parenthesis ().<\/p>\n<blockquote><p>TupleExample = (6, 9, &#8220;Clase &#8220;, [&#8220;Tarde &#8220;, &#8220;Dr. Strange &#8220;])<\/p><\/blockquote>\n<p>You can do many things with these type of data, for example you can select a certain element that is inside the list or tuple. In the following example you will get the first element on the list, the first element has a <div class=\"post-limited-image\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/firstprogrammingsteps.wordpress.com\/336\/\" \/><\/div>\n<div class=\"post-limited-image\"><img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=firstprogrammingsteps.wordpress.com&#038;blog=115170367&%23038;post=336&%23038;subd=firstprogrammingsteps&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/><\/div><!--more--> index.<\/p>\n<blockquote><p>ListExample [0]<\/p><\/blockquote>\n<p>You can also obtain how many\u00a0 elements a list contain. The next code will obtain the number of elements that the tupple contain, it doesn&#8217;t matter which type of data is inside the tupple. Also is worth noticing that a list inside a tupple will only be counted as one element, it doesn&#8217;t matter how many elements are inside that list.<\/p>\n<blockquote><p>len(TupleExample)<\/p><\/blockquote>\n<p>You can check this links if you want to know more about this topic.<\/p>\n<p><a href=\"https:\/\/docs.python.org\/3.3\/tutorial\/datastructures.html\" rel=\"nofollow\">https:\/\/docs.python.org\/3.3\/tutorial\/datastructures.html<\/a><\/p>\n<p><a href=\"http:\/\/www.openbookproject.net\/books\/bpp4awd\/ch03.html\" rel=\"nofollow\">http:\/\/www.openbookproject.net\/books\/bpp4awd\/ch03.html<\/a><\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/firstprogrammingsteps.wordpress.com\/336\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/firstprogrammingsteps.wordpress.com\/336\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=firstprogrammingsteps.wordpress.com&#038;blog=115170367&%23038;post=336&%23038;subd=firstprogrammingsteps&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Hackerman&amp;#039;s house I review this topic with my good friend Sebastian Cede\u00f1o, we read a lot about this topic and made this really cool post. So bad that I had to finish it and upload it, so im doing this really late in friday night. There is a little bit of regreat &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/lists-and-tuples-3\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lists and Tuples<\/span><\/a><\/p>\n","protected":false},"author":59,"featured_media":356,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[363,364,96,24,365,97],"class_list":["post-38821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-bff","tag-chema","tag-lists","tag-python","tag-team","tag-tuples"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=38821"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38821\/revisions"}],"predecessor-version":[{"id":38823,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38821\/revisions\/38823"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=38821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=38821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=38821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}