{"id":334,"date":"2022-05-16T16:26:24","date_gmt":"2022-05-16T15:26:24","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/?page_id=334"},"modified":"2022-05-16T16:35:40","modified_gmt":"2022-05-16T15:35:40","slug":"running-total","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/running-total\/","title":{"rendered":"Running Total"},"content":{"rendered":"<p>Many programs need to calculate a running total to find the sum of a list of numbers or<br \/>\nto calculate the average.<\/p>\n<p>Values are repeatedly input in a loop and are added to a running total each time round the loop.<\/p>\n<p>The average can be found by dividing the final total by the number of items.<\/p>\n<p>The algorithms <strong>must always set the value in the variable to 0 before the loop.<\/strong><\/p>\n<h2 style=\"color: red\"><strong>Python Code Example<\/strong><\/h2>\n<h2 style=\"color: red\"><strong><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-336\" src=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714-300x81.png\" alt=\"\" width=\"862\" height=\"233\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714-300x81.png 300w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714-1024x277.png 1024w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714-768x208.png 768w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714-624x169.png 624w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162729\/Screenshot-2022-05-16-162714.png 1260w\" sizes=\"auto, (max-width: 862px) 100vw, 862px\" \/><\/strong><\/h2>\n<h2 style=\"color: red\"><strong>Pseudocode Code Example<\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-338\" src=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914-300x85.png\" alt=\"\" width=\"731\" height=\"207\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914-300x85.png 300w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914-1024x289.png 1024w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914-768x217.png 768w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914-624x176.png 624w, https:\/\/blogs.glowscotland.org.uk\/glowblogs\/public\/phsn5computingscience\/uploads\/sites\/10033\/2022\/05\/16162928\/Screenshot-2022-05-16-162914.png 1260w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many programs need to calculate a running total to find the sum of a list of numbers or to calculate the average. Values are repeatedly input in a loop and are added to a running total each time round the loop. The average can be found by dividing the final total by the number 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-334","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/334","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=334"}],"version-history":[{"count":5,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/334\/revisions"}],"predecessor-version":[{"id":341,"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/pages\/334\/revisions\/341"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/glowblogs\/phsn5computingscience\/wp-json\/wp\/v2\/media?parent=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}