{"id":171,"date":"2023-06-11T20:34:40","date_gmt":"2023-06-11T20:34:40","guid":{"rendered":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/?page_id=171"},"modified":"2023-06-11T20:34:40","modified_gmt":"2023-06-11T20:34:40","slug":"programming-error-types","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/","title":{"rendered":"Programming Error Types"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Tutorial Video<\/h2>\n<div class=\"tabcontent\">\n\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\" data-mce-fragment=\"1\"><\/iframe><\/p>\n\n<\/div><h2 class=\"tabtitle\">Syntax Errors<\/h2>\n<div class=\"tabcontent\">\n\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\" \/><\/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\n<\/div><h2 class=\"tabtitle\">Runtime Errors<\/h2>\n<div class=\"tabcontent\">\n\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\n<\/div><h2 class=\"tabtitle\">Logical<\/h2>\n<div class=\"tabcontent\">\n\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\n<\/div><h2 class=\"tabtitle\">Teacher Resources<\/h2>\n<div class=\"tabcontent\">\n\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<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Syntax, Runtime and Logical Errors Tutorial Video Can&#8217;t access YouTube? Click Here Syntax Errors These are errors where the computer cannot interpret the inputted code and therefore cannot compile or translate the code. These ares are usually the first errors that a programmer will encounter and are the easiest to spot, as the computer will&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Programming Error Types<\/span><\/a><\/p>\n","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":"off","neve_meta_content_width":100,"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>Programming Error Types - Edexcel iGCSE Computer Science<\/title>\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\/edexcel-igcse-computer-science\/programming-error-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Programming Error Types - Edexcel iGCSE Computer Science\" \/>\n<meta property=\"og:description\" content=\"Syntax, Runtime and Logical Errors Tutorial Video Can&#8217;t access YouTube? Click Here Syntax Errors These are errors where the computer cannot interpret the inputted code and therefore cannot compile or translate the code. These ares are usually the first errors that a programmer will encounter and are the easiest to spot, as the computer will&hellip;&nbsp;Read More &raquo;Programming Error Types\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/\" \/>\n<meta property=\"og:site_name\" content=\"Edexcel iGCSE Computer Science\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/\",\"url\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/\",\"name\":\"Programming Error Types - Edexcel iGCSE Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/#website\"},\"datePublished\":\"2023-06-11T20:34:40+00:00\",\"dateModified\":\"2023-06-11T20:34:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming Error Types\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/#website\",\"url\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/\",\"name\":\"Edexcel iGCSE Computer Science\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Programming Error Types - Edexcel iGCSE Computer Science","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\/edexcel-igcse-computer-science\/programming-error-types\/","og_locale":"en_GB","og_type":"article","og_title":"Programming Error Types - Edexcel iGCSE Computer Science","og_description":"Syntax, Runtime and Logical Errors Tutorial Video Can&#8217;t access YouTube? Click Here Syntax Errors These are errors where the computer cannot interpret the inputted code and therefore cannot compile or translate the code. These ares are usually the first errors that a programmer will encounter and are the easiest to spot, as the computer will&hellip;&nbsp;Read More &raquo;Programming Error Types","og_url":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/","og_site_name":"Edexcel iGCSE Computer Science","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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/","url":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/","name":"Programming Error Types - Edexcel iGCSE Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/#website"},"datePublished":"2023-06-11T20:34:40+00:00","dateModified":"2023-06-11T20:34:40+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/programming-error-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/"},{"@type":"ListItem","position":2,"name":"Programming Error Types"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/#website","url":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/","name":"Edexcel iGCSE Computer Science","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Syntax, Runtime and Logical Errors Tutorial Video Can&#8217;t access YouTube? Click Here Syntax Errors These are errors where the computer cannot interpret the inputted code and therefore cannot compile or translate the code. These ares are usually the first errors that a programmer will encounter and are the easiest to spot, as the computer will&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/pages\/171"}],"collection":[{"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":1,"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/pages\/171\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/pages\/171\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/edexcel-igcse-computer-science\/wp-json\/wp\/v2\/media?parent=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}