Two Things I Learned in Computer Programming
By: Kelsey Lopez
Tags: Python, Command Line, Spyder, Basics, Programming

I have always hated programming. Ever since my first encounter with a computer code in high school, I knew this was something I wouldn’t pursue in the future. I even graduated college barely passing my two programming courses. However, when I was searching for available jobs for BS Mathematics graduates, most of the jobs I wanted required some programming knowledge. Of course I still tried applying because I thought maybe it’s okay since I possessed some of the skill requirements (which are mostly soft skills), but when interviews came, I would shrink into self-consciousness because deep down, I knew I was unqualified for the job. That’s when I realized I have to learn these programming languages.

Fast forward to today, I have now decided to take a path towards data science and turns out, programming is not as scary as I always deemed it to be. Here are two of the interesting things I learned so far:

First is using the command line to switch from one directory to another within your computer. To access it, just type cmd on your computer’s search bar and press enter or if you don’t like using your mouse, you can press the windows key and r simultaneously and a box like this will appear at the bottom left of your screen:

Just type cmd on the space provided, press enter and voila! You have accessed the command line.

Now, maybe you are wondering why it matters to know how to use the command line when we can simply click through different icons in our graphical user interface. That’s because there are certain computer commands that are only accessible through the command line. But for now, what I will show you is changing from one directory to another.

Once you have entered the command line, what you will see is a black screen with three lines of white text. The third line is the most important because it shows where you currently are in your computer. As you can see in my screen below, the user’s name is CATH because the previous owner of this laptop is named Cath.

Now, let’s try changing directories! We can do it by following the four simple steps below:

To switch from the current directory to the desktop directory, just type cd<space>desktop, where cd stands for change directory.

2. Now that we are in our desktop directory, we can go back from the previous directory by typing cd<space>.. or cd space dot dot and pressing enter.

3. Also, it is possible to move to two directories in a single line. If I want to go to my WORK folder in my desktop, I will just type cd<space>desktop\work

Note that I used a backslash symbol to include my second directory.

4. Lastly, going back to my original directory, I will just type cd<space>../.. where I now used a slash symbol.

Those are just four out of so many things to learn about command line. As I mentioned earlier, there are certain commands accessible only using the command line.

The next thing I want to share is the Spyder IDE, a scientific programming environment written in the Python language. As you can see in the photo below, there are only three main parts: the code block, the variable explorer, and the python console.

Basically, the code block is where you write your code, the variable explorer is where the assigned variables and their corresponding value appears, and the python console shows the output of your code. Let us try to write some code.

In the photo above, I used the print function in the code block to show the text “Hello!” in the python console. Noticeably, nothing different happened in the variable explorer since I have not assigned a value to any variable yet.

Note: To run your code, just press ctrl+enter or simply click the green play button at the top left (below “Debug”).

Now that I have assigned values to variables x,y and z, it has reflected in the variable explorer. Although, nothing was added to our “Hello!” text in the python console since we did not print anything. Let us try printing z in our next line and see what appears in the python console.

If I print “z” including the quotation marks, it treats z as plain text. On the other hand, without the quotation marks, it treats z as a variable.

Actually, this Spyder IDE is not completely new to me since we used it in one of my two programming courses. However, it feels like I’m still learning it for the first time since as I mentioned earlier, I used to hate programming. The only difference in learning it now is that I am excited to learn more.

That is it for now. I hope you enjoyed learning and relearning with me.