Project: My Introduction to Python

My first foray into learning another language

They say learning a new language is one of the most valuable skills you can learn, and while some may choose French or Spanish, I went with something a little different. Sit back as I go through my introduction to Python.

Why Python?

I picked Python over other programming languages for a few reasons, first off was the readability of it. Not only does this help you understand others' code easily but it also makes understanding what you’ve written, and importantly, what you're learning much easier. Being able to look back at your code and quickly understand the logic of it all makes the entire process of learning a coding language much less daunting.

Second up was the versatility of Python. Python has a wide range of applications, from machine learning and data analysis to web development and programming applications. This gives me a wide scope of what I can create with Python, it also means that wherever I am in my career it can have its uses.

Lastly,  was the growing popularity of the language. Python has been exploding in popularity over the past few years compared to other languages, this makes it not only an attractive skill to have but it also means I have access to a huge amount of current documentation and user-based problem solving. This is especially useful for someone like me who is starting out, knowing that it is very likely someone has run into the same issue as me, and that there are already up-to-date answers for those problems.

All of these reasons were why I settled on Python rather than Java or C#.

What I’ve Learned so Far

In order to learn Python I’ve been taking a course through Udemy called “2021 Complete Python Bootcamp From Zero to Hero in Python”, and as of writing this have just completed my first Milestone project, but more on that later. The course has been good at teaching me a strong understanding of Python, although study of the concepts is key if you want to really develop it as a skill.

I’m feeling good about my current understanding and skill level with Python and this was helped greatly by the time I spent working on the first Milestone Project from the course.

Tic-Tac-Toe Project

As you may have guessed the first Milestone Project in this course was to  develop a Tic-Tac-Toe game, using everything I’d learned so far and more. I say ‘and more’ because the game did require me to do some learning outside of the course, this is done so you can learn where and how to find information about concepts in the wild.

When I first started the project I was nervous that I wouldn't be able to apply what I had learned and would become stuck rather quickly, but this didn't end up being the case. Once I got started all of what I had learned began to come back to me and I was able to quickly come up with answers to the problems that lay ahead of me. 

I did bump into a couple problems that took some time to resolve, such as my ‘Win Condition’ Function which was showing a win after only 1 or 2 markers had been played. The issue was that I had an equality operator (==) at the end of a list of indexes thinking it would encapsulate all of them, when it actually was only checking against the final index in the list. The solution was to simply put an equality operator after each index point. This was a good lesson for me to realise, in terms of, what I thought I was telling my code and what my code was actually understanding.

Something that I’m really proud of with this project is how fault tolerant I was able to make the game. The solution provided by the course has a number of faults, primarily when asking for user input, where if the user inputs something other than the game asked for, the game breaks. I built my solution, using the knowledge that I had learned, to make sure that user input couldn't break my game. A particular Function that shows this is my ‘player_choice’ Function where I ask the user for a number between 1-9, to determine where they want to place their marker, and check to make sure:

  1. The inputs a number
  2. The input is within the range asked for
  3. The input has not already been selected

Before allowing it to be reference later in my code

So far my journey through Python has been an enjoyable one, with challenges and a few setbacks, but all of those have helped me gain a better understanding of the language. I plan to continue my learning with this course with the hopes to build something completely of my own by the end of it.