{"id":354,"date":"2022-05-16T17:14:09","date_gmt":"2022-05-16T16:14:09","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/?page_id=354"},"modified":"2022-05-16T17:18:10","modified_gmt":"2022-05-16T16:18:10","slug":"arrays","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/arrays\/","title":{"rendered":"Arrays"},"content":{"rendered":"<p>A For Loop is an arrays best friend for one reason \u2013 The\u00a0<strong>counter<\/strong>!\u200b<\/p>\n<p>Each loop has a counter and every time the loop is\u00a0completed the\u00a0<strong>counter<\/strong>\u00a0increases by one.\u200b<\/p>\n<p>This is extremely useful when populating and displaying\u00a0information. The For Loop allows the program to ask the user a question\u00a0multiple times and saving the inputs into different\u00a0Indexes of the array.\u200b\u00a0 As the counter increases by one each time, it is perfect to\u00a0use as a reference for the index.<\/p>\n<h2 style=\"color: red\"><strong>Python Code Example<\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-355\" src=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031-300x220.png\" alt=\"\" width=\"841\" height=\"617\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031-300x220.png 300w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031-1024x750.png 1024w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031-768x563.png 768w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031-624x457.png 624w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171045\/Screenshot-2022-05-16-171031.png 1260w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-356\" src=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309-300x86.png\" alt=\"\" width=\"950\" height=\"272\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309-300x86.png 300w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309-1024x293.png 1024w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309-768x219.png 768w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309-624x178.png 624w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171358\/Screenshot-2022-05-16-171309.png 1260w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-358\" src=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746-300x58.png\" alt=\"\" width=\"703\" height=\"136\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746-300x58.png 300w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746-1024x199.png 1024w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746-768x149.png 768w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746-624x121.png 624w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16171801\/Screenshot-2022-05-16-171746.png 1260w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A For Loop is an arrays best friend for one reason \u2013 The\u00a0counter!\u200b Each loop has a counter and every time the loop is\u00a0completed the\u00a0counter\u00a0increases by one.\u200b This is extremely useful when populating and displaying\u00a0information. The For Loop allows the program to ask the user a question\u00a0multiple times and saving the inputs into different\u00a0Indexes of [&hellip;]<\/p>\n","protected":false},"author":79984,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-354","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/users\/79984"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/comments?post=354"}],"version-history":[{"count":3,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/354\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/354\/revisions\/360"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/media?parent=354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}