{"id":11638,"date":"2015-08-02T07:31:14","date_gmt":"2015-08-02T07:31:14","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=11638"},"modified":"2015-08-02T07:31:14","modified_gmt":"2015-08-02T07:31:14","slug":"python-a-string-application","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/python-a-string-application\/","title":{"rendered":"Python:  a string application"},"content":{"rendered":"<h1>The tutor shows an example program centered around string indexing.<\/h1>\n<p>In my <a href=\"?p=11601\">July 31<\/a> post, I opened the topic of string indexing in Python.  A string, moving forward, starts at position [0]; however, from the end, it starts at [-1].<\/p>\n<p>The question could be asked, for a given string, the place where, read from the front, it coincides with the read from the back:<\/p>\n<p><span style=\"font-family:monospace;color:brown\"><br \/>\nnewstring=&#8221;Vancouver&#8221;<br \/>\nfor i in range(len(newstring)):<br \/>\n&nbsp;&nbsp;&nbsp;if newstring[i]==newstring[-(i+1)]:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&#8220;Coincidence index: &#8221; +str(i))<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&#8220;Coincidence character: &#8220;+newstring[i])<br \/>\n<\/span><br \/>\nproduces the output<br \/>\n<span style=\"font-family:monospace\"><br \/>\nCoincidence index: 4<br \/>\nCoincidence character: o<br \/>\n<\/span><br \/>\nString indexing can be very useful in certain applications:)<\/p>\n<p>Source:<\/p>\n<p>Donaldson, Toby.  <u>Python<\/u>, 3rd Ed.  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 shows an example program centered around string indexing. In my July 31 post, I &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/python-a-string-application\/\"> <span class=\"screen-reader-text\">Python:  a string application<\/span> Read more \u2192<\/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":[930,959,964],"class_list":["post-11638","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-python","tag-python-string-index","tag-python-strings"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11638","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=11638"}],"version-history":[{"count":14,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11638\/revisions"}],"predecessor-version":[{"id":11652,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11638\/revisions\/11652"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=11638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=11638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=11638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}