A Self-Taught Path to Coding: Month 2 Retrospective

Cover photo, a MacBook Pro setup
Photo by Alex Presa on Unsplash


For those of you who need an introduction, you can find one here:

When I decided a little over a month ago I was going to blog about my life, I was oblivious to how I might approach it. With that blissful ignorance I began to flesh out a draft of my approach to the task and it resulted in the article above.

Since then, I’ve read more blogs on tech topics, taking notes along the way and decided to switch up the format. I’m going to try and make a weekly series of blog posts about my challenges learning to code and how I overcome them.

This is the first post in that series and I plan to outline a problem I encountered at the end of my second month learning. It’s regarding loops in both Python and JavaScript.

The Problem

That’s from the Udacity CS101 course, lesson number 5 which I encountered at the start of June. If you’re like me, you think it sounds simple enough…in application to solving a problem, boy, was I wrong.

The lesson (for me) gave adequate but not great detail about the syntax/components of a for loop and no support for problem solving techniques. So when the course asked you to create a function with a loop to give the factorial of a number input(n), I was puzzled to say the least.

I was left to “poke and hope” at the code for the problem. I could fathom that we needed to increment the (n) value down by 1 and reinsert it back into the function I declared but no matter how I wrote it, this happened:

That’s called an infinite loop result, I would come to find out. It looks like the code does nothing.

I was at a loss. Worse yet, I was beginning to question if I was cut out for programming. The fabled impostor syndrome I read about had begun to set in.

I decided to blame the language and move on with other areas of my studies.

“Stupid Python.” I said as I decided to focus on Codecademy and JavaScript (where I was having a much better time). I thought eventually I’ll encounter something that will give me an idea.

The Solution

Three weeks passed and…nothing.

I had progressed with Codecademy and was enjoying it, but admittedly it was mostly HTML/CSS. I always had that problem in the back of my mind, though.

Then, finally, I made it to the more involved JavaScript lessons. I was excited because I could see that loops were a part of the curriculum.

At this point I had invested many hours into Codecademy and I knew the structure of their lessons and exercises would be detailed enough that I might get somewhere.

I was half right.

After taking the loop lesson and passing their basic exercise, I tried to program a factorial function and lo and behold! …

I got stuck.🤦🏻‍♂️

Now, it’s important that I mention my pride in my ability to learn. I never struggled in school. In fact, often I excelled with ease. Therefore, I was stubbornly insistent on not “cheating” and looking up the answer. I would learn this was misguided.

Besides, I didn’t really know who to ask for help. Or, how to word the question.

I had code in Python and JavaScript that would at least return a result. It was just wrong.

Python code problem
It was returning the input in Python…🤬
JavaScript code problem
At least in JavaScript it would iterate!🤷🏻‍♂️

I thought hard about what to do and I caved. I watched the Udacity tutorial for Python and revisited the loops lesson on Codecademy. In both cases, the solution felt so obvious once I found it; it did not, however take away from the pride of solving it myself in JavaScript.

Here is what they should look like solved proper:

Python code solution
The Python tells us that 5! = 120, hooray!🤘🏻🤓🤘🏻
JavaScript code solution
The JavaScript agrees! So, what’s the difference? Did you spot it?🤔

For Python, I remembered after seeing the solution video, that indentation and white space are critical to the syntax of your code and how it executes. So, with return result right under the while loop’s procedural code block it was returning the input. By simply aligning the return result with the while statement itself we get the proper result.

In JavaScript, the buggy results where a matter of where the console.log(result) was placed. When it is before the second to last closing curly bracket (}) then the loops code block includes it as an iterative step in the procedure. Outside of that second to last curly bracket and it returns just the final result!

If I hadn’t had the confidence of solving it in JavaScript after seeing it function in Python, I wouldn’t have had the bravery to ask for help on another problem later on that same day. Here is the start to the thread:

The response was fast and friendly. I thought, “No trolls? Is this really the internet?”

But user [at]domhabersack was helpful in making a suggestion without exactly giving the answer away.

I applied that suggestion and the code worked! I was even able to refine it from my initial solution to something that I thought was more readable/logical.

The imposter syndrome had subsided and I found my “groove” again.


I’m not sure if there will always be some wholesome meta lesson to wrap up my posts but I think today there is:

  1. It’s okay to not know the answer.
  2. It’s expected that you’ll need help when you’re starting out. So just ask!

Maybe I got lucky, but I’m holding out that this wasn’t a one-off. Faith in humanity restored.

Thanks for reading! If you liked this article…

Feel free to clap, share any open source projects or other suggestions in the comments or just drop a line to share your thoughts!

Follow My Journey: @ericjbible | /in/ericbible





Experienced BPO Project Manager | Noob Web Dev Follow My Coding Journey: https://twitter.com/ericjbible If You’re Hiring: http://linkedin.com/in/ericbible

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fixed bugs of external login in.net Core website behind the reverse proxy

Edge-Focused Compact Kubernetes with MicroPaaS (μPaaS) — k3s/k3OS and Rio

Deploy your Jina Flows on the Cloud

Let’s Learn Python in 30 Days

Sharing Results with Authorities Made Easy With Consolidated Report Generation

Self-Healing pods in Kubernetes & their Restart Policies

Top Predictions On Software Development Trends Of 2022

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Bible

Eric Bible

Experienced BPO Project Manager | Noob Web Dev Follow My Coding Journey: https://twitter.com/ericjbible If You’re Hiring: http://linkedin.com/in/ericbible

More from Medium

How to deploy a Git branch to Heroku

Heroku logo

How do I tell whether coding is something I’d be interested in learning?

Format your JS, CSS, and JSON automatically when you commit it

Refactoring With Confidence