A mockingbird in a field of grass.

Teaching Myself Python

Hey there.

I’ve been coding again (I’ve been off and on with it for a few years now), but to make things interesting I’ve decided to learn a whole new language (Python) with the specific goal of…

Coding Artificial Intelligence

Now, my ultimate goal is obviously to create an AI that can replace me at work, allowing me to get several thousand high-paying jobs all at once without any of my employers even noticing that I (the real me) am out somewhere gardening without a care in the world.

But to get there, I have to start with the basics. And for me, that’s learning Python, because up until this point I’ve mainly programmed in JavaScript.

It’s So Easy Nowadays

Learning to code is easier than ever because of a few different reasons.

The big one is that Harvard puts its Computer Science classes online… for free.

Seriously, you can learn how to code from exactly the same lectures as the ones Harvard students attend. And because of ChatGPT — you now have a personal tutor who can help explain the nuances of every topic to you in the clearest way possible.

An if a Harvard education isn’t enough for you, don’t worry.

I Have Another Secret Weapon…

Learning how to learn is the most important skill you can have. And luckily, I’ve cracked the code.

It turns out there’s a secret recipe to learn anything, even complex topics, in record time. It’s a simple 4-step process that anybody can use, even if you aren’t an expert, to become a master of any subject.

And I’m going to tell it to you right now… for free.

Here’s How It Works.

It’s called the Feynman Technique, named after a famous physicist named Richard Feynman who always impressed people with his clear articulation of complex subject.

He’d take something like Quantum Mechanics and explain it in a way a 10 year old could understand. At the time, everybody was shocked and thought he was just a once-in-a-generation genius… but it turns out he had a secret.

His secret was — the explanation itself.

You see, we all thought Richard Feynman just naturally understood difficult topics easier than we did, but that wasn’t the case at all. Feynman put great effort into explaining things because he knew something we’ve only just now realized:

Teaching Is Learning!

By learning something, and then forcing himself to explain it in simplistic terms, Feynman was solidifying his understanding of topics while at the same time identifying gaps in his own knowledge.

The fact that he took the time to explain things to others wasn’t showing off, it was necessary for learning and deep understanding.

Luckily, the process works for anyone, not just theoretical physicists.

And I’ll Break It Down Right Now

Next time you’re trying to learn something (like I am, with Python for AI), do this:

  1. Choose a concept: Select a topic that you want to learn or understand.
  2. Teach it to a child: Pretend like you are teaching the concept to a child who has no previous knowledge of the subject. Break down the information into simple terms and avoid using jargon or complex language.
  3. Identify gaps in your understanding: As you explain the concept, pay attention to areas where you struggle or stumble. These are likely areas where your understanding is not as strong. Identify these gaps so you can focus on filling them in.
  4. Review and simplify: Go back to your learning materials and review the concept again, focusing on the areas where you struggled. Try to simplify the explanations or find different analogies that make the concept clearer. Repeat this process until you can explain the concept without hesitation.

And Here’s An Example

I just learned about variables in Python. Variables are little containers that store data. They have a name, and we can pass them around inside our code. Sometimes, we’ll want to change the data that is stored in a variable, and we can do that too.

Take a look at this:

x = "Hello, world."

What’s happening here? This is a super simple example of assigning a variable a value.

The variable is called “x” and its value is some text that says, “Hello, world.”

Now, anywhere that I use the variable “x”, the value will be substituted in its place.

print(x)

The statement above will print the words “Hello, world.” to the console.

Pretty neat, right? And we can even change “x” to be something else if we wanted.

x = "Hello, world."

print(x)

x = "This is different."

print(x)

This block of code would print two different statements. First, it would print “Hello, world,” as expected. But then we reassign our variable “x” with a new value. So the second time the function print(x) runs, the value we’d see displayed on the screen would be, “This is different.”

Boom. I just taught you about variables. Job done, right?

Wrong.

It turns out, we’ve only scratched the surface of variables. There’s a whole bunch of other stuff I didn’t include in my explanation, like scope and variable shadowing, but that’s kind of the point.

There’s always more to learn.

And this teaching exercise, aka The Feynman Technique, is one of the most effective ways to learn.

So as I dive further into the depths of Python and AI, I’ll be using the “teach-as-you-go” strategy to ensure my own understanding of the principles of programming.

Yes, I’m teaching you.

But I’m teaching for me.

Whether or not that’s selfish is a philosophical topic for another day.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *