{"id":39434,"date":"2016-11-27T02:43:09","date_gmt":"2016-11-27T08:43:09","guid":{"rendered":"http:\/\/welcometotheheaven.wordpress.com\/?p=720"},"modified":"2016-11-27T02:43:09","modified_gmt":"2016-11-27T08:43:09","slug":"startstopstep","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/startstopstep\/","title":{"rendered":"([start],stop,[step])"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/welcometotheheaven.wordpress.com\/2016\/11\/27\/startstopstep\/\"><a href=\"https:\/\/welcometotheheaven.wordpress.com\">Welcome to the Heaven<\/a><\/a><\/em><br \/><\/p>\n<p>In this post you will learn how the function <span style=\"color:#99cc00;\">range <\/span><span><span style=\"color:#333333;\">acts. Is very common use this function in a loop when you want to the loop perform an action N number of times, also we can see it when we want to make operations\u00a0with numbers or print specific values of a list\/tuple.<\/span><\/span><\/p>\n<p>Let&#8217;s see a picture with some examples, an after that I will explain you how it works at each case.<\/p>\n<p><img class=\" size-medium wp-image-755 aligncenter\" src=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-35-18-am.png?w=300&#038;h=144\" alt=\"screen-shot-2016-11-27-at-2-35-18-am\" width=\"300\" height=\"144\" srcset=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-35-18-am.png?w=300&amp;h=144 300w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-35-18-am.png?w=600&amp;h=288 600w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-35-18-am.png?w=150&amp;h=72 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>As you can see in the title of this post ([start],stop,[step]), describes the way that act the first example. The range function always start form 0, so 0=first value. Start from 0 and the next number is going to be two numbers after.<\/p>\n<p>The second one and third one are the same, but I put it just because these are the two ways to write a range, but if you want to be more professional you must use the second one.<\/p>\n<p>The last one is the same as the first but with a difference in print. <span style=\"color:#0000ff;\">end=&#8221; &#8221;\u00a0<span style=\"color:#000000;\">makes that the function doesn&#8217;t go to the next line.<\/span><\/span><\/p>\n<p>And if you want to see another example with the power of two range loops:<\/p>\n<p><img class=\"alignnone size-medium wp-image-762\" src=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-37-06-am.png?w=300&#038;h=69\" alt=\"screen-shot-2016-11-27-at-2-37-06-am\" width=\"300\" height=\"69\" srcset=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-37-06-am.png?w=300&amp;h=69 300w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-37-06-am.png?w=600&amp;h=138 600w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-37-06-am.png?w=150&amp;h=34 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>With this little code we can do this:<\/p>\n<p><img class=\" size-medium wp-image-766 alignnone\" src=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-49-am.png?w=34&#038;h=300\" alt=\"screen-shot-2016-11-27-at-2-40-49-am\" width=\"34\" height=\"300\" srcset=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-49-am.png?w=34&amp;h=300 34w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-49-am.png?w=68&amp;h=600 68w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-49-am.png?w=17&amp;h=150 17w\" sizes=\"(max-width: 34px) 100vw, 34px\" \/><img class=\" size-medium wp-image-765 alignnone\" src=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-58-am.png?w=54&#038;h=300\" alt=\"screen-shot-2016-11-27-at-2-40-58-am\" width=\"54\" height=\"300\" srcset=\"https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-58-am.png?w=54&amp;h=300 54w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-58-am.png?w=108&amp;h=600 108w, https:\/\/welcometotheheaven.files.wordpress.com\/2016\/11\/screen-shot-2016-11-27-at-2-40-58-am.png?w=27&amp;h=150 27w\" sizes=\"(max-width: 54px) 100vw, 54px\" \/><\/p>\n<p><a href=\"http:\/\/pythoncentral.io\/pythons-range-function-explained\/\">Source<\/a>.<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/welcometotheheaven.wordpress.com\/720\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/welcometotheheaven.wordpress.com\/720\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=welcometotheheaven.wordpress.com&#038;blog=115373557&%23038;post=720&%23038;subd=welcometotheheaven&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Welcome to the Heaven In this post you will learn how the function range acts. Is very common use this function in a loop when you want to the loop perform an action N number of times, also we can see it when we want to make operations\u00a0with numbers or print specific &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/startstopstep\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">([start],stop,[step])<\/span><\/a><\/p>\n","protected":false},"author":32,"featured_media":755,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[33],"class_list":["post-39434","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39434","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\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=39434"}],"version-history":[{"count":14,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39434\/revisions"}],"predecessor-version":[{"id":43097,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39434\/revisions\/43097"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=39434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=39434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=39434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}