{"id":158,"date":"2021-03-14T17:29:22","date_gmt":"2021-03-14T17:29:22","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/?page_id=158"},"modified":"2025-03-05T11:24:10","modified_gmt":"2025-03-05T11:24:10","slug":"static-arrays","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/national-5\/static-arrays\/","title":{"rendered":"Arrays with Preset Values"},"content":{"rendered":"<p>A static array holds a number of preset values:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> #\r\nmonthnames = &#x5B;&quot;January&quot;, &quot;February&quot;, ...]\r\nmonthdays = &#x5B;31, 28, ...]\r\n#<\/pre>\n<p>Each item can be accessed by an index value:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> #\r\nindex = 5\r\nprint(f&quot;{monthnames&#x5B;index]} has {monthdays&#x5B;index]} days&quot;}\r\n#<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A static array holds a number of preset values: # monthnames = &#x5B;&quot;January&quot;, &quot;February&quot;, &#8230;] monthdays = &#x5B;31, 28, &#8230;] # Each item can be accessed by an index value: # index = 5 print(f&quot;{monthnames&#x5B;index]} has {monthdays&#x5B;index]} days&quot;} # &nbsp;<\/p>\n","protected":false},"author":7,"featured_media":0,"parent":337,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-158","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/pages\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":6,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/pages\/158\/revisions"}],"predecessor-version":[{"id":769,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/pages\/158\/revisions\/769"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/pages\/337"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingpython\/wp-json\/wp\/v2\/media?parent=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}