{"id":370,"date":"2023-02-14T13:22:01","date_gmt":"2023-02-14T13:22:01","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/?page_id=370"},"modified":"2023-02-15T09:14:39","modified_gmt":"2023-02-15T09:14:39","slug":"challenge-5","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-2\/challenge-5\/","title":{"rendered":"Challenge 5"},"content":{"rendered":"\n<p>Open your previous challenge program where you tested a single exam result and printed the comment that matched.<\/p>\n\n\n\n<p>Save a new version of the file and alter it so that it now asks the user to enter the exam result which will be a whole number between 0 and 100. It should print the value entered and the comment that matches.<\/p>\n\n\n\n<p>Remember that the input function returns a string, but you need it to be an integer to compare to another integer. Otherwise you&#8217;ll see an error like this:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"109\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/14132828\/error.png\" alt=\"An error message from comparing a str to an int\" class=\"wp-image-381\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/14132828\/error.png 699w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/14132828\/error-300x47.png 300w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/figure><\/div>\n\n\n\n<p>Now if only there was a function that converted things to integers&#8230;<\/p>\n\n\n\n<p class=\"nextlink\"><a href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-2\/error-handling\/\" data-type=\"page\" data-id=\"375\">Next: Error handling<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open your previous challenge program where you tested a single exam result and printed the comment that matched. Save a new version of the file and alter it so that it now asks the user to enter the exam result which will be a whole number between 0 and 100. It should print the value&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-2\/challenge-5\/\">Continue reading <span class=\"screen-reader-text\">Challenge 5<\/span><\/a><\/p>\n","protected":false},"author":5710,"featured_media":0,"parent":16,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-370","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/users\/5710"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/comments?post=370"}],"version-history":[{"count":4,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/370\/revisions"}],"predecessor-version":[{"id":382,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/370\/revisions\/382"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/16"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/media?parent=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}