top of page

04.21.2018: One Lesson of Python

Today's soundtrack is Sleep: The Sciences.

Today was my best friend's wedding; I was honoured to be his best man. The wedding was beautiful.

This evening, I'm continuing on to the next chapter in Coding Projects in Python, "Secret Messages." In this lesson, I'll be building a program that can both encode and decode messages.

I started by importing the necessary modules, then created a function that allows users to tell the program whether they wish to encrypt or decrypt a message, then created another function that will give users a place to type in the message that they want to encrypt or decrypt. Next, I entered a command for Tkinter to open. Finally, I created a loop that would integrate these functions and commands.

Once I verified that that all worked, it was time to scramble the messages. I wrote a function that determined whether an input was of even or odd number of letters. Then I wrote a function that would swap the letters around, adding an "x" if the message was of an odd number of letters.

It worked!


bottom of page