{"id":2456,"date":"2025-02-20T07:59:48","date_gmt":"2025-02-20T07:59:48","guid":{"rendered":"https:\/\/teacherkyle.xyz\/?page_id=2456"},"modified":"2025-02-24T01:13:00","modified_gmt":"2025-02-24T01:13:00","slug":"secret-code-coding","status":"publish","type":"page","link":"https:\/\/teacherkyle.xyz\/index.php\/secret-code-coding\/","title":{"rendered":"Secret Code Coding"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>computer code<\/td><td>\u96fb\u8166\u7a0b\u5f0f\u78bc<\/td><td>Di\u00e0nn\u01ceo ch\u00e9ngsh\u00ec m\u01ce<\/td><\/tr><tr><td>secret<\/td><td>\u79d8\u5bc6<\/td><td>m\u00ecm\u00ec<\/td><\/tr><tr><td>code<\/td><td>\u7a0b\u5f0f\u78bc<\/td><td>ch\u00e9ngsh\u00ec m\u01ce<\/td><\/tr><tr><td>encode<\/td><td>\u7de8\u78bc<\/td><td>bi\u0101nm\u01ce<\/td><\/tr><tr><td>decode<\/td><td>\u89e3\u78bc<\/td><td>ji\u011bm\u01ce<\/td><\/tr><tr><td>message<\/td><td>\u8a0a\u606f<\/td><td>x\u00f9nx\u00ed<\/td><\/tr><tr><td>spy<\/td><td>\u9593\u8adc<\/td><td>Ji\u00e0ndi\u00e9<\/td><\/tr><tr><td>mission<\/td><td>\u4f7f\u547d<\/td><td>Sh\u01d0m\u00ecng<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You are a spy. You have a secret mission. You have a message: <\/p>\n\n\n\n<p>The target is wkxq, the key is 14.<\/p>\n\n\n\n<p>Who is the target? We have to save them. The target&#8217;s name is encoded.<\/p>\n\n\n\n<p>We have a way to decode messages. First put the key in the middle of the circle. Look at what happens when we make the key higher or lower. Then to DECODE the message find the gray letter that matches our message. Then the blue or purple letter that is touching the gray letter is the decoded letter.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"426\" height=\"204\" src=\"https:\/\/teacherkyle.xyz\/wp-content\/uploads\/decodedORencoded.png\" alt=\"\" class=\"wp-image-2474\"\/><\/figure>\n\n\n\n<iframe width= '700' height='700' src='https:\/\/www.101computing.net\/cipher-wheel.html'><\/iframe>\n\n\n\n<p>Let&#8217;s try encoding and decoding. First pick a number between 5 and 20.<\/p>\n\n\n\n<p>Write this on your paper: key:_______  <\/p>\n\n\n\n<p>Write your name on your paper. To encode your name you need to find the blue and purple letters that match your name. Then the gray letters that touch the blue and purple letters are encoded.<\/p>\n\n\n\n<p>Now fold your paper so that only  you can only see the key and the encoded message. <\/p>\n\n\n\n<p>Ok, now that we have tried to encode and decode, let&#8217;s try to write some code to do it for us.<\/p>\n\n\n\n<p>We&#8217;re going to follow this lesson.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.junyiacademy.org\/article\/7b3df2aa6ba345e3a0dbacbf56807476\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.junyiacademy.org\/article\/7b3df2aa6ba345e3a0dbacbf56807476<\/a><\/p>\n\n\n\n<p>This is a link to a python interpreter.<\/p>\n\n\n\n<p><a href=\"http:\/\/jumpto.cc\/python-new\" target=\"_blank\" rel=\"noreferrer noopener\">jumpto.cc\/python-new<\/a><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>commands<\/td><td>\u547d\u4ee4<\/td><td>M\u00ecngl\u00ecng<\/td><\/tr><tr><td><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">print<\/span><\/strong><\/td><td>\u5217\u5370<\/td><td>Li\u00e8 y\u00ecn<\/td><\/tr><tr><td>name = &#8216;Kyle&#8217;<br><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">print<\/span><\/strong>(&#8216;this is my name: &#8216;,name)<\/td><td>this is my name: kyle<\/td><td><\/td><\/tr><tr><td><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">input<\/span><\/strong><\/td><td>\u8f38\u5165<\/td><td>sh\u016br\u00f9<\/td><\/tr><tr><td>name = <strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">input<\/span><\/strong>(&#8216;please enter your name: &#8216;)<\/td><td><\/td><td><\/td><\/tr><tr><td><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">find<\/span><\/strong><\/td><td>\u5c0b\u627e<\/td><td>x\u00fanzh\u01ceo<\/td><\/tr><tr><td>name = &#8216;Kyle&#8217;<br>position = name.<strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">find<\/span><\/strong>(&#8216;K&#8217;)<br>print(position)<\/td><td>0<\/td><td><\/td><\/tr><tr><td>% modulo<\/td><td>% \u6a21\u9664<\/td><td>M\u00f3 sh\u00f9<\/td><\/tr><tr><td>integer |  <strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">int<\/span><\/strong>()<\/td><td>\u6574\u6578<\/td><td>Zh\u011bngsh\u00f9<\/td><\/tr><tr><td>number = 14<br>print (<strong>int<\/strong>(number) +1<\/td><td>15<\/td><td><\/td><\/tr><tr><td><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">for <\/span><\/strong>loop<\/td><td>for \u8ff4\u5708<\/td><td>For hu\u00ed qu\u0101n<\/td><\/tr><tr><td><strong>for <\/strong>each letter <strong>in <\/strong>the word do this<\/td><td>\u5c0d\u55ae\u5b57\u4e2d\u7684\u6bcf\u500b\u5b57\u6bcd\u90fd\u57f7\u884c\u6b64\u64cd\u4f5c<\/td><td>Du\u00ec d\u0101nz\u00ec zh\u014dng de m\u011bi g\u00e8 z\u00ecm\u01d4 d\u014du zh\u00edx\u00edng c\u01d0 c\u0101ozu\u00f2<\/td><\/tr><tr><td>word = &#8216;Kyle&#8217;<br><strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">for <\/span><\/strong>letter <strong><span style=\"color: #cf2e2e;\" class=\"stk-highlight\">in <\/span><\/strong>word:<br>print(letter)<\/td><td>K<br>y<br>l<br>e<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>variables<\/td><td>\u8b8a\u6578<\/td><td>bi\u00e0nsh\u00f9<\/td><\/tr><tr><td>alphabet = abcdefghijklmnopqrstuvwxyz<\/td><td>\u5b57\u6bcd<\/td><td>Z\u00ecm\u01d4<\/td><\/tr><tr><td>key<\/td><td>\u9470\u5319<\/td><td>y\u00e0oshi<\/td><\/tr><tr><td>position<\/td><td>\u4f4d\u7f6e<\/td><td>w\u00e8izh\u00ec<\/td><\/tr><tr><td>message<\/td><td>\u8a0a\u606f<\/td><td>x\u00f9nx\u00ed<\/td><\/tr><tr><td>letter<\/td><td>\u5b57\u6bcd<\/td><td>Z\u00ecm\u01d4<\/td><\/tr><tr><td>new<\/td><td>\u65b0\u7684<\/td><td>x\u012bn de<\/td><\/tr><tr><td>camel case \/ camelCase<\/td><td>\u99dd\u5cf0\u5f0f\u547d\u540d\u6cd5<\/td><td>Tu\u00f3f\u0113ng sh\u00ec m\u00ecngm\u00edng f\u01ce<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"1057\" src=\"https:\/\/teacherkyle.xyz\/wp-content\/uploads\/camelCase.png\" alt=\"\" class=\"wp-image-2475\" srcset=\"https:\/\/teacherkyle.xyz\/wp-content\/uploads\/camelCase.png 1280w, https:\/\/teacherkyle.xyz\/wp-content\/uploads\/camelCase-768x634.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>please enter an English letter:<\/td><td>\u8acb\u8f38\u5165\u82f1\u6587\u8a0a\u606f:<\/td><td>q\u01d0ng sh\u016br\u00f9 y\u012bngw\u00e9n x\u00f9nx\u00ed:<\/td><\/tr><tr><td>the new letter is:<\/td><td>\u65b0\u4fe1\u4ef6\u662f:<\/td><td>X\u012bn x\u00ecnji\u00e0n sh\u00ec:<\/td><\/tr><tr><td>enter &#8220;e&#8221; for encode or &#8220;d&#8221; for decode:<\/td><td>\u8f38\u5165\u201ce\u201d\u9032\u884c\u7de8\u78bc\u6216\u8f38\u5165\u201cd\u201d\u9032\u884c\u89e3\u78bc:<\/td><td>Sh\u016br\u00f9 \u201ce\u201d j\u00ecnx\u00edng bi\u0101nm\u01ce hu\u00f2 sh\u016br\u00f9 \u201cd\u201d j\u00ecnx\u00edng ji\u011bm\u01ce:<\/td><\/tr><tr><td>please input the message:<\/td><td>\u8acb\u8f38\u5165\u7559\u8a00\u5167\u5bb9\uff1a<\/td><td>q\u01d0ng sh\u016br\u00f9 li\u00fay\u00e1n n\u00e8ir\u00f3ng:<\/td><\/tr><tr><td>please enter the key:<\/td><td>\u8acb\u8f38\u5165\u5bc6\u9470\uff1a<\/td><td>Q\u01d0ng sh\u016br\u00f9 m\u00ec y\u00e0o:<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>% <strong>\u6a21\u9664<\/strong>\uff08\u82f1\u8a9e\uff1amodulo&nbsp;\u6709\u6642\u4e5f\u7a31\u4f5c modulus\uff09\uff0c\u53c8\u7a31<strong>\u6a21\u6578<\/strong>\u3001<strong>\u53d6\u6a21<\/strong>\u3001<strong>\u53d6\u6a21\u904b\u7b97<\/strong>\u7b49\uff0c\u5b83\u5f97\u51fa\u4e00\u500b\u6578\u9664\u4ee5\u53e6\u4e00\u500b\u6578\u7684\u9918\u6578\u3002\u7d66\u5b9a\u5169\u500b\u6b63\u6578\uff1a<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E8%A2%AB%E9%99%A4%E6%95%B8\">\u88ab\u9664\u6578<\/a> <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/ffd2487510aa438433a2579450ab2b3d557e5edc\" alt=\"{\\displaystyle a}\"> \u548c<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E9%99%A4%E6%95%B8\">\u9664\u6578<\/a> <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/a601995d55609f2d9f5e233e36fbe9ea26011b3b\" alt=\"{\\displaystyle n}\">\uff0c<img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/535482b6288a25e7f29337332ad477c27554c71f\" alt=\"{\\displaystyle a\\,\\operatorname {modulo} \\,n}\">\uff08\u901a\u5e38\u7e2e\u5beb\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/764c02a8811b874cd89ca3495ecd5fdb68bf6869\" alt=\"{\\displaystyle a{\\bmod {n}}}\">\uff09\uff0c\u5f97\u5230\u7684\u662f\u4f7f\u7528<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%AC%A7%E5%87%A0%E9%87%8C%E5%BE%97%E9%99%A4%E6%B3%95\">\u6b50\u5e7e\u91cc\u5f97\u9664\u6cd5<\/a>\u6642\u7684<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E4%BD%99%E6%95%B0\">\u9918\u6578<\/a>\u3002<img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/1b2a52fb906cc6d2e3485dafbdd96fd5d0d48140\" alt=\"{\\displaystyle a{\\bmod {1}}}\"> \u6240\u5f97\u4e4b\u6578\u88ab\u7a31\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/ffd2487510aa438433a2579450ab2b3d557e5edc\" alt=\"{\\displaystyle a}\"> \u7684<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%B0%8F%E6%95%B0\">\u5c0f\u6578<\/a>\u90e8\u4efd\u3002<\/p>\n\n\n\n<p>\u8209\u500b\u4f8b\u5b50\uff1a\u8a08\u7b97\u8868\u9054\u5f0f <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/64901ea3e08f83fd92a0854a57716fc76a9042ee\" alt=\"{\\displaystyle 5{\\bmod {2}}}\"> \u5f97\u5230 <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/92d98b82a3778f043108d4e20960a9193df57cbf\" alt=\"{\\displaystyle 1}\">\uff0c\u56e0\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/a5170302f5339076e4c76e449d4450d8edab9f63\" alt=\"{\\displaystyle 5\\div 2}\"> \u7684\u5546\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/901fc910c19990d0dbaaefe4726ceb1a4e217a0f\" alt=\"{\\displaystyle 2}\"> \u800c\u9918\u6578\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/92d98b82a3778f043108d4e20960a9193df57cbf\" alt=\"{\\displaystyle 1}\"> \uff1b\u800c<img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/573f0c6080ce946137dba6d927fe08588eb19945\" alt=\"{\\displaystyle 9{\\bmod {3}}}\"> \u5f97\u5230<img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/2aae8864a3c1fec9585261791a809ddec1489950\" alt=\"{\\displaystyle 0}\">\uff0c\u56e0\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/406243b6e4e88b5dfffc4feead0b78ac2cfbd78f\" alt=\"{\\displaystyle 9\\div 3}\"> \u7684\u5546\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/991e33c6e207b12546f15bdfee8b5726eafbbb2f\" alt=\"{\\displaystyle 3}\"> \u800c\u9918\u6578\u70ba <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/2aae8864a3c1fec9585261791a809ddec1489950\" alt=\"{\\displaystyle 0}\">\uff1b<\/p>\n\n\n\n<iframe width= '700' height='700'  src='https:\/\/trinket.io\/library\/trinkets\/create?lang=python'><\/iframe>\n\n\n\n<p>Example code:<\/p>\n\n\n\n<p>doWhat = input(&#8216;enter &#8220;e&#8221; for encode or &#8220;d&#8221; for decode&#8217;)<\/p>\n\n\n\n<p>key = input(&#8216;please enter the key:&#8217;) % 26&nbsp;<\/p>\n\n\n\n<p>if doWhat == &#8220;d&#8221; :<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; key = 26 &#8211; int(key)<\/p>\n\n\n\n<p>message = input(&#8216;please input the message:&#8217;)<\/p>\n\n\n\n<p>newMessage = &#8221;<\/p>\n\n\n\n<p>alphabet = &#8216;abcdefghijklmnopqrstuvwxyz&#8217;<\/p>\n\n\n\n<p>for char in message:<\/p>\n\n\n\n<p>&nbsp; tempChar = char<\/p>\n\n\n\n<p>&nbsp; position = alphabet.find(char)<\/p>\n\n\n\n<p>&nbsp; #print (position)<\/p>\n\n\n\n<p>&nbsp; newPosition = (int(position) + int(key))%26<\/p>\n\n\n\n<p>&nbsp; newChar = alphabet[newPosition]<\/p>\n\n\n\n<p>&nbsp; newMessage += newChar<\/p>\n\n\n\n<p>print(newMessage)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>computer code \u96fb\u8166\u7a0b\u5f0f\u78bc Di\u00e0nn\u01ceo ch\u00e9ngsh\u00ec m\u01ce secret \u79d8\u5bc6 m\u00ecm\u00ec code \u7a0b\u5f0f\u78bc ch\u00e9ngsh\u00ec m\u01ce encode \u7de8\u78bc bi\u0101nm\u01ce decode \u89e3\u78bc ji\u011bm\u01ce message \u8a0a\u606f x\u00f9nx\u00ed spy \u9593\u8adc Ji\u00e0ndi\u00e9 mission \u4f7f\u547d Sh\u01d0m\u00ecng You are a spy. You have a secret mission. You have a message: The target is wkxq, the key is 14. Who is the target? We have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"first-template","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-2456","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/pages\/2456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=2456"}],"version-history":[{"count":17,"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/pages\/2456\/revisions"}],"predecessor-version":[{"id":2497,"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/pages\/2456\/revisions\/2497"}],"wp:attachment":[{"href":"https:\/\/teacherkyle.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=2456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}