{"id":565,"date":"2018-11-08T18:01:54","date_gmt":"2018-11-08T18:01:54","guid":{"rendered":"http:\/\/learnlearn.uk\/gcsecs\/?page_id=565"},"modified":"2018-11-19T09:26:37","modified_gmt":"2018-11-19T09:26:37","slug":"syntax-runtime-logical-errors","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/","title":{"rendered":"Syntax, Runtime and Logical Errors"},"content":{"rendered":"\n<div class=\"arconix-tabs-horizontal\"><ul class=\"arconix-tabs\"><li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-TutorialVideo\"><a class=\"\" href=\"#tab-TutorialVideo\">Tutorial Video<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-SyntaxErrors\"><a class=\"\" href=\"#tab-SyntaxErrors\">Syntax Errors<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-RuntimeErrors\"><a class=\"\" href=\"#tab-RuntimeErrors\">Runtime Errors<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-Logical\"><a class=\"\" href=\"#tab-Logical\">Logical<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-TeacherResources\"><a class=\"\" href=\"#tab-TeacherResources\">Teacher Resources<\/a><\/li><\/ul>\n<div class=\"arconix-panes\"><div class=\"arconix-pane pane-TutorialVideo\">\n<h3>Syntax, Runtime and Logical Errors Tutorial Video<\/h3>\n<p><a href=\"https:\/\/drive.google.com\/open?id=1T8bmxFrRuqyAVgKYx1zDsp-xfvgTpke_\">Can&#8217;t access YouTube? Click Here<\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/ToPP5UGgJUM\" width=\"853\" height=\"480\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div>\n<div class=\"arconix-pane pane-SyntaxErrors\">\n<h3>Syntax Errors<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignright size-full wp-image-571\" src=\"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2017\/01\/error2.jpg\" alt=\"Syntax, Runtime and Logical Errors\" width=\"225\" height=\"225\" srcset=\"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2017\/01\/error2.jpg 225w, https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2017\/01\/error2-150x150.jpg 150w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/p>\n<p>These are errors where the computer cannot interpret the inputted code and therefore cannot compile or translate the code.<\/p>\n<p>These ares are usually the first errors that a programmer will encounter and are the easiest to spot, as the computer will usually inform you of the offending line.<\/p>\n<p><strong>Example 1<\/strong><\/p>\n<pre>name = input('Nice to meet you)<\/pre>\n<p>Here the code is missing a closing inverted comma.<\/p>\n<p><strong>Example 2<\/strong><\/p>\n<pre>age = int(input(\"how old are you?\")))<\/pre>\n<p>Here the code has closed too many brackets.<\/p>\n<\/div>\n<div class=\"arconix-pane pane-RuntimeErrors\">\n<h3>Runtime errors<\/h3>\n<p>These are errors that are not detected until the program is running. The program executes successfully until a certain point, where it crashes.<\/p>\n<p>These errors often occur because of:<\/p>\n<ul>\n<li>Failing to does type conversions (e.g. from string it integer)<\/li>\n<\/ul>\n<p><strong>Example 1<\/strong><\/p>\n<pre>age = input('How old are you?')\r\n\r\nif age &gt; 50:\r\n\r\n\u00a0 \u00a0 print('You are old!')<\/pre>\n<p>Here the program will successfully run and ask for an age input. However on the second line the program will crash because age has been input as a string and therefore needs to be reassigned or cast as an integer before being compared to the 50.<\/p>\n<p><strong>Example 2<\/strong><\/p>\n<pre>shopping = ['cheese','egg','beef']\r\n\r\nprint(shopping[3])<\/pre>\n<p>Here the program will crash when it attempts to\u00a0 print out index 3. This is because Python starts indexing from 0, not 1 and therefore item 3 does not exist.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"arconix-pane pane-Logical\">\n<h3>Logical Errors<\/h3>\n<p>These are errors that do not cause the program to crash, but simply do not function as the code intended. Since the program does not crash, these errors are often the most difficult to spot and therefore the most dangerous errors. These errors can only be detected through thorough testing.<\/p>\n<p><strong>Example 1\u00a0<\/strong><\/p>\n<pre>age = int(input('How old are you?'))\r\n\r\nif age &lt; 50:\r\n\r\n\u00a0 \u00a0 print('You are old!')\r\n\r\nelse:\r\n\r\n\u00a0 \u00a0 print('You are young!')<\/pre>\n<p>Here the code will execute without an error, however the comparison operator &lt; is the wrong one. It&#8217;s should be &lt;.<\/p>\n<p><strong>Example 2<\/strong><\/p>\n<pre>while True:\r\n\r\n\u00a0 \u00a0 answer = input('Press enter to break out of the loop')\r\n\r\n\u00a0 \u00a0 if answer == \"\u00a0 \u00a0\":\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 break<\/pre>\n<p>Here the program contains too many spaces inside of the &#8221;\u00a0 \u00a0 &#8220;. This will mean that the user would have to input 3 spaces for the program to break, not one. The program would not crash, it would simply keep looping forever&#8230;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"arconix-pane pane-TeacherResources\">\n<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vRfxYrFUpERS1lxz2dsh1P1ZgJ-u5gEVRCA14vZKKWkYpHn_5NyWYhZJUoHRQ0pktRCpXUn-3nYyRd-\/pub?start=false&amp;loop=false&amp;delayms=1800000&amp;slide=id.g47c4f98c38_0_46\">Presentation<\/a><\/p>\n<p><a href=\"https:\/\/play.kahoot.it\/#\/k\/cab4af43-d782-4cd7-a18f-8859424a3bd3\">Kahoot &#8211; Error Types Kahoot<\/a><\/p>\n<p><a href=\"https:\/\/docs.google.com\/document\/d\/1kDbFnovyDp2wywGfU4brVq8ceVw90xoZ3_xj5peWa5U\/edit?usp=sharing\">Worksheet<\/a><\/p>\n<\/div><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Syntax, Runtime and Logical Errors - GCSE Computer Science Theory<\/title>\n<meta name=\"description\" content=\"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Syntax, Runtime and Logical Errors - GCSE Computer Science Theory\" \/>\n<meta property=\"og:description\" content=\"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/\" \/>\n<meta property=\"og:site_name\" content=\"GCSE Computer Science Theory\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-19T09:26:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2017\/01\/error2.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/\",\"url\":\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/\",\"name\":\"Syntax, Runtime and Logical Errors - GCSE Computer Science Theory\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#website\"},\"datePublished\":\"2018-11-08T18:01:54+00:00\",\"dateModified\":\"2018-11-19T09:26:37+00:00\",\"description\":\"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"OCR GCSE Computer Science Home\",\"item\":\"https:\/\/learnlearn.uk\/gcsecs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Syntax, Runtime and Logical Errors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/gcsecs\/\",\"name\":\"GCSE Computer Science Theory\",\"description\":\"Just another My Blog site\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/gcsecs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#organization\",\"name\":\"GCSE Computer Science Theory\",\"url\":\"https:\/\/learnlearn.uk\/gcsecs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2019\/02\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2019\/02\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"GCSE Computer Science Theory\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/gcsecs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Syntax, Runtime and Logical Errors - GCSE Computer Science Theory","description":"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/","og_locale":"en_GB","og_type":"article","og_title":"Syntax, Runtime and Logical Errors - GCSE Computer Science Theory","og_description":"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.","og_url":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/","og_site_name":"GCSE Computer Science Theory","article_modified_time":"2018-11-19T09:26:37+00:00","og_image":[{"url":"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2017\/01\/error2.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/","url":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/","name":"Syntax, Runtime and Logical Errors - GCSE Computer Science Theory","isPartOf":{"@id":"https:\/\/learnlearn.uk\/gcsecs\/#website"},"datePublished":"2018-11-08T18:01:54+00:00","dateModified":"2018-11-19T09:26:37+00:00","description":"Syntax, Runtime and Logical errors lesson, including a tutorial video, examples and a quiz resources.","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/gcsecs\/syntax-runtime-logical-errors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"OCR GCSE Computer Science Home","item":"https:\/\/learnlearn.uk\/gcsecs\/"},{"@type":"ListItem","position":2,"name":"Syntax, Runtime and Logical Errors"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/gcsecs\/#website","url":"https:\/\/learnlearn.uk\/gcsecs\/","name":"GCSE Computer Science Theory","description":"Just another My Blog site","publisher":{"@id":"https:\/\/learnlearn.uk\/gcsecs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/gcsecs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/gcsecs\/#organization","name":"GCSE Computer Science Theory","url":"https:\/\/learnlearn.uk\/gcsecs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/gcsecs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2019\/02\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/gcsecs\/wp-content\/uploads\/sites\/8\/2019\/02\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"GCSE Computer Science Theory"},"image":{"@id":"https:\/\/learnlearn.uk\/gcsecs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/gcsecs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":null,"_links":{"self":[{"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/pages\/565"}],"collection":[{"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":8,"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/pages\/565\/revisions"}],"predecessor-version":[{"id":732,"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/pages\/565\/revisions\/732"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/gcsecs\/wp-json\/wp\/v2\/media?parent=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}