Welcome back to another edition of {Kids: Code}, the free weekly coding newsletter! Last week we talked a bit about something called “encryption,” and this week we’re going to now get to know the opposite - “decryption.” We also have a bunch of stories from programmers making creative and inspiring works that we hope can inspire you as well.
Want to reach out to us? You can contact us here or check us out on Twitter!
Welcome back to part 2 of our mini encryption breakdown! Last week, we walked through what encryption is - and we built a small script to show you how it works. This week we're going to keep it short and sweet - let's look at how to decrypt (or undo) the encryption we did last week.
What is Decryption?
Decryption is just the inverse (or opposite) of encryption: if encryption means we're hiding something, decryption means we're showing it.
Last week, we built ourselves a mini toy encryption script:
KEY = {
"A": "Z",
"B": "C"
}
text = "BANANA"
encrypted_text = ""
for letter in text:
uppercase = letter.upper()
if uppercase in KEY:
encrypted_text += KEY[uppercase]
else:
encrypted_text += uppercase
print(encrypted_text)
With the above code, BANANA
would become CZNZNZ
- our cipher (or key) replaces B
with C
and A
with Z
. Building a decryption script doesn't actually require too many changes - in fact, for this basic example, we can just invert our key, like so:
KEY = {
"Z": "A",
"C": "B"
}
text = "CZNZNZ"
decrypted_text = ""
for letter in text:
uppercase = letter.upper()
if uppercase in KEY:
decrypted_text += KEY[uppercase]
else:
decrypted_text += uppercase
print(decrypted_text)
Take a look at our KEY
variable - our new script just has to swap the letters back, and then it's good to go!
Your Own Keys
Did you try adding your own letters toKEY
? Remember, you can build your own special key to make your own special hidden messages!
This week at {Kids: Code} we wanted to take the opportunity to share some great projects from around the Internet that showcase the creativity that aspiring coders have! For example, check out this solar system app created by a student using Code.org. You can play around with it and even check out the code that was used to build it.
Another project is actually from a student project aiming to make a game! This team built a prototype for an alternative controller - one that a person with physical disabilities would be able to use. You can see it in action below!
And lastly we have a story out of Houston, Texas where a robotics team faced a tense situation that could’ve cost them their competitions due to a missing phone. You can read about the rookie team from Carver High School here and see where they got their beginnings and how they made it out of their unexpected challenge.
Stanford’s A.I Grading Tool
Computer scientists at Stanford University have built an AI (artificial intelligence) tool to make grading students’ homework a whole lot easier. This was done through machine learning where the tool was taught about all the different problems that students receive on their homework, but the problem that professors faced was that homework assignments and tests change all the time. This is where “meta-learning” came into play - the process of a machine learning about a lot of things with little information.
You can read more about this exciting development here!
This Week’s Vocabulary Word
Decryption
The act of revealing some data that was previously encrypted (a message, image, or anything else) with a key or cipher.