{"id":38413,"date":"2016-10-26T18:54:20","date_gmt":"2016-10-26T23:54:20","guid":{"rendered":"http:\/\/a00344371.wordpress.com\/?p=265"},"modified":"2016-10-26T18:54:20","modified_gmt":"2016-10-26T23:54:20","slug":"for-loops-4","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/for-loops-4\/","title":{"rendered":"For loops"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/a00344371.wordpress.com\/2016\/10\/26\/for-loops\/\"><a href=\"https:\/\/a00344371.wordpress.com\">Programming Fundaments<\/a><\/a><\/em><br \/><\/p>\n<p>Usually for loops are used for range loops (list) , usually the syntax is this:<\/p>\n<pre class=\"prettyprint notranslate prettyprinted\"><span class=\"kwd\">for<\/span><span class=\"pln\"> iterating_var <\/span><span class=\"kwd\">in<\/span><span class=\"pln\"> sequence<\/span><span class=\"pun\">:<\/span><span class=\"pln\">\n   statements<\/span><span class=\"pun\">(<\/span><span class=\"pln\">s<\/span><span class=\"pun\">)<\/span><\/pre>\n<p>The difference with the &#8220;with&#8221; loops is that you don&#8217;t have to have &#8220;true&#8221; or &#8220;false&#8221; variables because it is used for lists. Example:<\/p>\n<pre class=\"prettyprint notranslate tryit prettyprinted\"><span class=\"kwd\">for<\/span><span class=\"pln\"> letter <\/span><span class=\"kwd\">in<\/span> <b><span class=\"str\">'Python'<\/span><span class=\"pun\">:<\/span><\/b>     \n   <span class=\"kwd\">print<\/span> <span class=\"str\">'Current Letter :'<\/span><span class=\"pun\">,<\/span><span class=\"pln\"> letter<\/span><\/pre>\n<p>Resulting in:<\/p>\n<pre class=\"result notranslate\">Current Letter : P\nCurrent Letter : y\nCurrent Letter : t\nCurrent Letter : h\nCurrent Letter : o\nCurrent Letter : n<\/pre>\n<p>&nbsp;<\/p>\n<p>Examples and more from:\u00a0https:\/\/www.tutorialspoint.com\/python\/python_for_loop.htm<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/a00344371.wordpress.com\/265\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/a00344371.wordpress.com\/265\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=a00344371.wordpress.com&#038;blog=115285426&%23038;post=265&%23038;subd=a00344371&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Programming Fundaments Usually for loops are used for range loops (list) , usually the syntax is this: for iterating_var in sequence: statements(s) The difference with the &#8220;with&#8221; loops is that you don&#8217;t have to have &#8220;true&#8221; or &#8220;false&#8221; variables because it is used for lists. Example: for letter in &#8216;Python&#8217;: print &#8216;Current &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/for-loops-4\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">For loops<\/span><\/a><\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[37,24,33],"class_list":["post-38413","post","type-post","status-publish","format-standard","hentry","category-blogs","category-syndicated","tag-programming","tag-python","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38413","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\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=38413"}],"version-history":[{"count":5,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38413\/revisions"}],"predecessor-version":[{"id":43095,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38413\/revisions\/43095"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=38413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=38413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=38413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}