Learn Python For Beginners

Learning Python For Beginners

Python is by far the most commonly suggested programming language for beginners. This is because learning python for beginners is easy to understand and with enough time it will allow you to adapt your knowledge to learning any other programming language. Understand that learning a programming language is not the same as learning how to engineer software, but it’s the clear first step.

Why Python For Beginners?

Python is a high-level programming language, which is just a fancy way to say it is far removed from using 1s and 0s. Think of programming languages as a hierarchy where binary or machine language is way at the bottom, python would be pretty high at the top, and something like C++ might belong towards the middle. If that sounds confusing don’t worry, it will become clear as you learn more programming languages.

Python is used for a wide variety of application such as data science, video games, artificial intelligence, and so, so much more. In fact most programming languages can achieve pretty much the same thing. Again, it’s not the knowledge you have, it’s how you apply that knowledge but that’s why learning python for beginners is one of the best routes to take as it will set you up with a good foundation of knowledge to apply to problems.

Installing Python

Getting started with python is easy. Head over to python website to download the latest version of python to your computer. It should look like this

Learning Python For Beginners

After downloading python you will be able to install it like any other application on your OS. Just know when installing python it’s important to make sure the box that says “add to path” is checked. If it doesn’t give you the option to check such a box, you are fine to continue. After doing so, you could technically start writing python programs right now. The default IDE (integrated development environment) that comes with python, however, is not the greatest. By far the most common way to write python-specific software is with the PyCharm IDE. Head to the PyCharm IDE download page and make sure you are getting the right download for your OS. Also, be sure to get the community edition as it’s completely free.

Learning Python For Beginners

After running install on the downloaded exe or pkg, open up PyCharm. Click on File -> New Project to start a new Python Project. The first time that you open PyCharm, you will see a big plus sign. You can also start a new project by clicking on that Icon. Whichever way you start a new project you should get a screen that looks like this

Writing Python For Beginners

Learning Python For Beginners

Notice how the “Create a main.py welcome script” box has been unchecked. If left unchanged PyCharm would have automatically generated an entrypoint script for us which is nice, but since we are just starting to learn python, we want to start from scratch.

Learning Python For Beginners

On the right side of the PyCharm IDE, you can see the hierarchy of the folders and files of wherever you put your project when you created it. Right click on the top directory. For me it’s “Learn Python” -> New -> Python File. Type “main” in the input field that comes up and hit Enter. You don’t have to name the file main. If you wanted you could name it bananas. But until we get to naming conventions in python, stick with main. You now just created your first python file.

After that we can finally start writing python code. Let the fun begin! You can make your first program ever in just one line of code. In the main.py file, type the following

Learning Python For Beginners
Learning Python For Beginners

Running Python Programs

When using the print statement like above, the statement must be followed by parentheses that contain the data we want to put to the screen. After doing so, click on the green play icon in the top right corner.

Learning Python For Beginners

When you run a python program, what happens next depends on the code you have written in the IDE. The print statement sends data out via a terminal. Right now we are just printing a string of characters. More on strings later. PyCharm, the integrated development environment we are using, contains a built in terminal which will expand from the bottom of the window. Your computer also has a terminal built into it. If you are using a mac you can open a terminal by running spotlight search and searching for “terminal”. On windows you will find a built-in terminal by hitting the windows key and searching for “cmd”. When you click run you should look like this:

Learning Python For Beginners
Learning Python For Beginners

Congratulations! You just completed your first python program. Give yourself a pat on the back, and continue your journey learning python with python operators. Hopefully you can see now how learning python for beginners can be an easy task for anyone with a little determination. Throughout this series you will find that learning the concepts in python don’t get much harder than this. As long as you pay attention, write out the code yourself, and think through the logic you will do great.

What Else Is There In Python?

Know that this course does not cover the entirety of python but rather the basics. After finishing this series of lessons you will easily be able to learn more advanced concepts in python. Certain ideas are hard to understand until you have a great understanding of the fundamentals. As a challenge, you should try to make the output be something different than the traditional ‘Hello World’.

Leave a Comment

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