Using Python to Create a Dictionary
Big news coming soon! But until then, let’s continue with today’s blog post…
Yesterday I realized the “me from 6 weeks ago” loved hard work, not smart work.
Here’s the story of how I wasted time using Python the wrong way…
I used my math and programming knowledge yesterday to create my own secret code.
It turns a phrase like “hello world” into “p|TH{xd'E1tI?”
The most tedious task is creating a dictionary to assign every character a corresponding number that’s later used to run some math equations.
6 weeks ago, I created a similar secret code but did the stupidest thing when building a dictionary.
Naive Mike thought it would be a good idea to type out every letter of the alphabet by hand and randomly assign each a different number — praying I didn’t accidentally repeat numbers.
Here’s why that method’s terrible…
It wastes a lot of time. A LOT.
I’m smarter now.
The dictionary I’m creating is bigger, so rather than typing everything by hand, I created a Python function that does it all for me.
This is the beauty of programming…
Once you understand how a language works, you can automate life and do work faster.
Here’s the code I used to create a dictionary fast…