{"id":11553,"date":"2015-07-27T07:51:06","date_gmt":"2015-07-27T07:51:06","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=11553"},"modified":"2015-07-27T07:51:06","modified_gmt":"2015-07-27T07:51:06","slug":"python-lack-of-punctuation","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/python-lack-of-punctuation\/","title":{"rendered":"Python:  (lack of) punctuation"},"content":{"rendered":"<h1>The tutor comments on a possibly surprising characteristic of Python.<\/h1>\n<p>Unlike Perl or Java, Python doesn&#8217;t use semicolons at the end of statements.  Furthermore, it doesn&#8217;t use braces around loops.  A loop body is indicated by indentation:<br \/>\n<span style=\"font-family:monospace;color:olive\"><br \/>\nfor i in range(3):<br \/>\n&nbsp;&nbsp;&nbsp;print(&#8220;Hello, &#8220;)<br \/>\n&nbsp;&nbsp;&nbsp;print(&#8220;how are you?&#8221;)<br \/>\n&nbsp;&nbsp;&nbsp;print(&#8220;\\n&#8221;)<br \/>\nprint(&#8220;Cheers:)&#8221;)<br \/>\n<\/span><\/p>\n<p>yields the output<\/p>\n<p><span style=\"font-family:monospace\"><br \/>\nHello,<br \/>\nhow are you?<br \/>\nHello,<br \/>\nhow are you?<br \/>\nHello,<br \/>\nhow are you?<br \/>\nCheers:)<br \/>\n<\/span><\/p>\n<p>Notice that the indented <span style=\"font-family:monospace\">print<\/span> statements are executed each pass through the loop, while the non-indented <span style=\"font-family:monospace\">print<\/span> statement is only executed once.<\/p>\n<p>Python&#8217;s sparse use of punctuation might surprise programmers from other languages:)<\/p>\n<p>Source:<\/p>\n<p>Donaldson, Toby. <u>Python<\/u>, 3rd Edition.  Peachpit Press, 2014.<\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The tutor comments on a possibly surprising characteristic of Python. Unlike Perl or Java, Python doesn&#8217;t use semicolons at the end of statements. Furthermore, it doesn&#8217;t use braces around loops. A loop body is indicated by indentation: for i in &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/python-lack-of-punctuation\/\"> <span class=\"screen-reader-text\">Python:  (lack of) punctuation<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[948,930,947],"class_list":["post-11553","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-indentation","tag-python","tag-python-loops"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=11553"}],"version-history":[{"count":15,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11553\/revisions"}],"predecessor-version":[{"id":11568,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11553\/revisions\/11568"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=11553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=11553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=11553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}