top of page

Getting Started With Python

If you've been looking at world news, it would be evident that coding jobs are a rapidly expanding and in demand profession. In 2015, there were seven million job openings for coders across the globe, and the field is still growing with an employment increase of 12% faster than the market average. The founders of Google, Facebook, Apple, and Microsoft are just some of many technologists who used their skills to make billions in the tech industry. FANG stocks have consistently outperformed the market, many of them holding on despite this ongoing bear market. So it should be clear to anyone looking for a promising career path that coding is the way to go. But unfortunately, the question for many how? Learning coding often takes thousands of dollars for classes and dozens of hours in research. While I can't promise that learning to code will be a breeze (it certainly takes a lot of effort), I will do my best to help people looking to get started on their way to learning how to code. I will also include links for great free coding courses, (I can assure you I don't get awarded for referrals). I recommend you use the online code editor repl.it to follow along with the code I provide.


Vocabulary:


Before we start, we will need an understanding of some basic coding vocabulary. Here goes:


1. Variable: A value assigned for the computer to remember.

2. Console: An area of your screen where your code will show it's output.

3. Syntax: Rules about what your computer will and will not understand. Think of it as grammar, and your computer a harsh english teacher. Anything that does not follow the rules of syntax, the code will reject.


Setup:


In order to start coding, we need to have a code editor and an open python file to begin coding. Go to repl.it, create your account, and click "new repl". Choose Python as the language from the drop down list (not python 2.7 or python with turtle). And name your project whatever you like, as long as it is descriptive. On the far left of your screen you should see a list of all the files in your project, in the middle you should see an empty textbox where we will put in our code, and on the right you will see a black screen where we will see the output of our code. The middle part is called the editor, and the black screen is called the console. Your screen should look something like the image below.




Python Variables, and Talking to the computer.


Think of coding as a way to talk with the computer, because that's exactly what it is ( hence the name programming language). Perhaps the most important part of programming is something called variables. Essentially, variables are values that you tell your computer to remember. For example, if I tell my computer to remember the number three as x, it will remember that x = 3. Let's see this in code.


x = 3

Great! Now we have assigned the variable x to 3. But how do we actually see if our computer can remember it? Let's run the following code in your repl.it editor:


x = 3
print(x)

The print() command is a way for you to tell your computer to display text into the console. Specifically, it will display whatever you put into the parentheses. There are specific rules about syntax for print statements, but we will go into that in a later post. Let's do a little more practice with print statements. In order to print text, we put quotation marks around whatever we are printing like so:


print("Hello World")

That will output "Hello World" into our console. In order to run out code and have the console actually show anything, we have to click "run" at the top of our screen. After we do that, your screen should look something like this:




If it does, great! You have now learned how to use variables, and have them print text. If it doesn't look like the image above, go back and check your work. You will get in eventually! The learning curve for coding is VERY steep, but with enough practice, the rewards are immense.



コメント


bottom of page