Week 14: Bitten by Python

Python logo over a snake background

I have often heard that learning a second programming language is much easier than learning the first. Having just started to dabble in Python after learning a bit of JavaScript I can already confirm the truth of that statement.

Let me first say that I am by no means an expert in JavaScript. At best I am moderately competent with JS but I received a copy of The Self-Taught Programmer for Christmas and it uses Python for its coding examples.

Since I couldn’t wait to begin reading it, I have started working with Python a bit sooner than expected.

In a perfect world, I would have spent more time working on JavaScript before transitioning to Python but…

Plans Change

The more information I have gathered the more convinced I have become that I should focus on JavaScript as my first language. That certainly wasn’t the plan when I started out.

It wasn’t even my second plan, which was to focus on WordPress and PHP. It wasn’t the third plan either. That was to learn the basics of HTML, CSS, and JavaScript before moving on to Ruby. There was even a fifth plan, which was to learn the basics but follow it up with Python instead of Ruby.

I moved through those first few plans in the first month or so of learning to program. Since then, I have been planning to learn Python and I’ve been excited about that prospect.

That is why I couldn’t resist starting to learn Python despite realizing the importance of learning JavaScript well.

My current plan, we’ll call it 5.1, is to continue to work primarily on JS while dabbling in Python.

Taking on a second language while still learning a first isn’t ideal but I think there are some valuable lessons in The Self-Taught Programmer. Because of that, I read that book sooner rather than later and that means using Python.

Easier the Second Time Around

When you are learning your first programming language you are actually learning two different things. You are learning the syntax of that language and you are also learning overarching programming concepts like variables, data types, and control structures.

Once you start working on your second language you have a better understanding of programming concepts and you can focus on the syntax of that language. That is what makes learning a second language so much easier.

Take For Loops for example.

In JavaScript a For Loop that prints “Hello, World!” one hundred times looks like this:

JavaScript For Loop example

The first time you learn about For Loops you have to learn what they are used for, how they work, what the different statements mean, and finally, how to write them.

Learning For Loops in a new language is just a matter of finding out how to write them. Even without knowing Python, if I told you the following snippet of code was a For Loop you could easily figure out how it works.

Pythong For Loop exampleBut There’s More Python!

Not content to distract myself with a little bit of Python on the side, I decided to double down and start the Automate the Boring Stuff with Python course on Udemy as well.

I am a sucker for building projects and the course is aimed at teaching the user how to use Python to automate common tasks.

Yes, it is a bit of a tangent but it is a fairly short course and the appeal of being able to complete a few projects while learning the basics of Python appeals to me.

The Algorithms Continue

Besides my normal Treehouse lessons and the side trip into Python, I also continued working on the Basic Algorithm Challenges from freeCodeCamp.

These have been difficult but fun. The solutions to some problems have just jumped out at me while others have required a lot of trial and error and Google-foo.

One of the things that I really enjoy about working on algorithms is how there is more than one solution. As a new programmer, I find it interesting and informative to compare my solutions with those of others.

I couldn’t help but chuckle the time I realized that my complex solution with multiple variables could be boiled down to this:

Slasher Flick Algorithm

If you want to check out my work you can find all my solutions in this CodePen Collection.

Happy New Year and I’ll talk to you again soon!

Sharing is caring!

Author: Lee

Hi, my name is Lee and I am a 40-something who recently made the decision to become a self-taught programmer. This site was set up to chronicle that journey and my experiences along the way. Feel free to contact me with any comments, questions, or suggestions.

Leave a Reply

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

15 − three =