{"id":197,"date":"2024-08-22T16:37:09","date_gmt":"2024-08-22T16:37:09","guid":{"rendered":"https:\/\/learnx.ca\/mt\/?page_id=197"},"modified":"2025-08-02T15:14:03","modified_gmt":"2025-08-02T15:14:03","slug":"coding-numbers","status":"publish","type":"page","link":"https:\/\/learnx.ca\/mt\/coding-numbers\/","title":{"rendered":"CODING PUZZLES"},"content":{"rendered":"\n<p>[<a href=\"#s\">Solutions<\/a>&nbsp;are shown after the puzzles]<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 1: Number patterns (Scratch)<\/h4>\n\n\n\n<p>Go to <a href=\"https:\/\/scratch.mit.edu\/projects\/453644929\/editor\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/scratch.mit.edu\/projects\/453644929\/editor<\/a><\/p>\n\n\n\n<p>Run the code. You should get the list of numbers shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"283\" height=\"208\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c1.png\" alt=\"\" class=\"wp-image-237\" style=\"width:379px;height:auto\"\/><\/figure>\n\n\n\n<p><strong>1.<\/strong> Edit the code to get each of the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"244\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c2.png\" alt=\"\" class=\"wp-image-238\" style=\"width:617px;height:auto\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c2.png 466w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c2-300x157.png 300w\" sizes=\"auto, (max-width: 466px) 85vw, 466px\" \/><\/figure>\n\n\n\n<p><strong>2.<\/strong> Edit the code to list the odd numbers 1-19 in reverse order: 19, 17, 15, 13, 11, 9, 7, 5, 3, 1.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 2: Number sums (Scratch)<\/h4>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"344\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c3.png\" alt=\"\" class=\"wp-image-240\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c3.png 355w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c3-300x291.png 300w\" sizes=\"auto, (max-width: 355px) 85vw, 355px\" \/><\/figure>\n<\/div>\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/scratch.mit.edu\/projects\/457027214\/editor\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/scratch.mit.edu\/projects\/457027214\/editor<\/a><\/li>\n\n\n\n<li>Run the code. You should get the lists of numbers and sums shown on the right.<\/li>\n\n\n\n<li>Edit the code to list and find the sum of numbers 10, 20, 30, and 40. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to list and find the sum of numbers 100, 200, 300, and 400. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to list and find the sum of numbers 11, 22, 33, and 44. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to list and find the sum of numbers 111, 222, 333, and 444. Can you predict their sum?<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 3: Number patterns (Python)<\/h4>\n\n\n\n<p><strong>EVEN NUMBERS<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"30\" height=\"105\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c6.png\" alt=\"\" class=\"wp-image-243\" style=\"width:37px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/console\/\" target=\"_blank\" rel=\"noreferrer noopener\">cscircles.cemc.uwaterloo.ca\/console<\/a> and enter and run the code below. It will list the first 5 even numbers.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"219\" height=\"46\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c5.png\" alt=\"\" class=\"wp-image-242\" style=\"width:276px;height:auto\"\/><\/figure>\n\n\n\n<ol style=\"list-style-type:upper-alpha\" class=\"wp-block-list\">\n<li>Edit the code to list the first 10 even numbers.<\/li>\n\n\n\n<li>Edit the code to list the even numbers 6 to 20.<\/li>\n<\/ol>\n\n\n\n<p><strong>ODD<\/strong><strong> NUMBERS<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the code to list:<ul><li>The first 5 odd numbers<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li>The odd numbers 11 to 25<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><strong>NATURAL<\/strong><strong> NUMBERS<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the code to list:<ul><li>The first 10 natural numbers<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li>The natural numbers 10 to 20<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 4: Number sums (Python)<\/h4>\n\n\n\n<p><strong>NATURAL NUMBERS &amp; THEIR SUMS<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/console\/\" target=\"_blank\" rel=\"noreferrer noopener\">cscircles.cemc.uwaterloo.ca\/console<\/a><\/li>\n\n\n\n<li>Enter and run the code below. It will list the first 4 natural numbers and their sums.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"286\" height=\"110\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c8.png\" alt=\"\" class=\"wp-image-244\" style=\"width:362px;height:auto\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit the code to find the sum of numbers 10, 20, 30, and 40. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to find the sum of numbers 100, 200, 300, and 400. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to find the sum of numbers 11, 22, 33, and 44. Can you predict their sum?<\/li>\n\n\n\n<li>Edit the code to find the sum of numbers 111, 222, 333, and 444. Can you predict their sum?<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading has-dark-gray-color has-text-color has-link-color wp-elements-fd657f999b5c075dfd639e73e4ea691e\" id=\"s\">SOLUTIONS<\/h1>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 1: Number patterns (Scratch)<\/h4>\n\n\n\n<p><strong>1.A.<\/strong> &nbsp;set number to 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p><strong>1.B.&nbsp;<\/strong> set number to 1; change number by 2<\/p>\n\n\n\n<p><strong>1.C. <\/strong>&nbsp;set number to 2; change number by 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p><strong>1.D.<\/strong>&nbsp; set number to 3; change number by 3<\/p>\n\n\n\n<p><strong>1.E.<\/strong> &nbsp;set number to 500; change number by 500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<p><strong>2.&nbsp; <\/strong>set number to 19; change number by -2&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 2: Number sums (Scratch)<\/h4>\n\n\n\n<p><strong>3. <\/strong>To print multiples of 10, make these edits:<\/p>\n\n\n\n<p>    <strong>a. <\/strong><span style=\"font-size: revert;\">Set number to <\/span><strong style=\"font-size: revert;\">10<\/strong><\/p>\n\n\n\n<p>    <strong>b. <\/strong>Change number by <strong>10<\/strong><\/p>\n\n\n\n<p><strong>4.<\/strong> To print multiples of 100, make these edits:<\/p>\n\n\n\n<p>    <strong>a.<\/strong> <span style=\"font-size: revert;\">Set number to <\/span><strong style=\"font-size: revert;\">100<\/strong><\/p>\n\n\n\n<p>    <strong>b. <\/strong>Change number by <strong>100<\/strong><\/p>\n\n\n\n<p><strong>5. <\/strong>To print multiples of 11, make these edits:<\/p>\n\n\n\n<p>     <strong>a. <\/strong><span style=\"font-size: revert;\">Set number to <\/span><strong style=\"font-size: revert;\">11<\/strong><\/p>\n\n\n\n<p>     <strong>b. <\/strong>Change number by <strong>11<\/strong><\/p>\n\n\n\n<p><strong>6. <\/strong>To print multiples of 111, make these edits:<\/p>\n\n\n\n<p>    <strong>a. <\/strong><span style=\"font-size: revert;\">Set number to <\/span><strong style=\"font-size: revert;\">111<\/strong><\/p>\n\n\n\n<p>    <strong>b.<\/strong> Change number by <strong>111<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h6 class=\"wp-block-heading\">How Puzzle 2 Code Works<\/h6>\n\n\n\n<p>The code calculates and lists the natural numbers and their sums.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using <strong>set number to 1<\/strong> and <strong>change number by 1<\/strong>, the code calculates and lists numbers 1-4.<\/li>\n\n\n\n<li>Using <strong>set sum to 0<\/strong> and <strong>set sum to sum + number<\/strong>, the code calculates and lists the sums of the numbers 1-4.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"429\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c4.png\" alt=\"\" class=\"wp-image-241\" style=\"width:628px;height:auto\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c4.png 487w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c4-300x264.png 300w\" sizes=\"auto, (max-width: 487px) 85vw, 487px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h6 class=\"wp-block-heading\">Variations<\/h6>\n\n\n\n<ol class=\"wp-block-list\">\n<li>To list and find the sums of odd numbers, edit <strong>change number by 1<\/strong> to <strong>change number by 2<\/strong>.<\/li>\n\n\n\n<li>To list and find the sums of even numbers, edit <strong>set number to 1<\/strong> to <strong>set<\/strong> <strong>number = 2<\/strong> and <strong>change number by 1<\/strong> to <strong>change number by 2.<\/strong><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 3: Number patterns (Python)<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"534\" height=\"219\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c7.png\" alt=\"\" class=\"wp-image-245\" style=\"width:629px;height:auto\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c7.png 534w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c7-300x123.png 300w\" sizes=\"auto, (max-width: 534px) 85vw, 534px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Coding Puzzle 4: Number sums (Python)<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"628\" height=\"296\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c9.png\" alt=\"\" class=\"wp-image-246\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c9.png 628w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c9-300x141.png 300w\" sizes=\"auto, (max-width: 628px) 85vw, 628px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>HOW PUZZLE 4 CODE WORKS<\/strong><\/p>\n\n\n\n<p>The code calculates and prints natural numbers and their sums.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using <strong>number = 1<\/strong> and <strong>number = number + 1<\/strong>, the code calculates and lists the numbers 1-4.<\/li>\n\n\n\n<li>Using <strong>SUM = 0<\/strong> and <strong>SUM = SUM + number<\/strong>, the code calculates and lists the sums of the numbers.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"511\" height=\"342\" src=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c10.png\" alt=\"\" class=\"wp-image-247\" style=\"width:630px;height:auto\" srcset=\"https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c10.png 511w, https:\/\/learnx.ca\/mt\/wp-content\/uploads\/2024\/08\/numbers-c10-300x201.png 300w\" sizes=\"auto, (max-width: 511px) 85vw, 511px\" \/><\/figure>\n\n\n\n<p><strong>VARIATIONS<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>To list and find the sums of odd numbers, change <strong>number = number + 1<\/strong> to <strong>number = number + 2.<\/strong><\/li>\n\n\n\n<li>To list and find the sums of even numbers, change <strong>number = 1<\/strong> to <strong>number = 2<\/strong>, and <strong>number = number + 1<\/strong> to <strong>number = number + 2.<\/strong><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Solutions&nbsp;are shown after the puzzles] Coding Puzzle 1: Number patterns (Scratch) Go to https:\/\/scratch.mit.edu\/projects\/453644929\/editor Run the code. You should get the list of numbers shown below. 1. Edit the code to get each of the following: 2. Edit the code to list the odd numbers 1-19 in reverse order: 19, 17, 15, 13, 11, 9, &hellip; <a href=\"https:\/\/learnx.ca\/mt\/coding-numbers\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;CODING PUZZLES&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-197","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/pages\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":13,"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/pages\/197\/revisions"}],"predecessor-version":[{"id":765,"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/pages\/197\/revisions\/765"}],"wp:attachment":[{"href":"https:\/\/learnx.ca\/mt\/wp-json\/wp\/v2\/media?parent=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}