Python -Chapter 1

Chapter 1


Python

There are many things that you can consider when getting started on your first project in coding. You need to figure out what kind of operating system you would like to use to write your code. You need to have a good idea of the types of code you would like to write as well as the end result so that you can concentrate on the code that you need to make that program that you want. And you need to pick out the type of programming language that you would like to work with. 

Most beginners like to go with the Python coding language because it is easy to use, can be used across all of the platforms, and has a lot of versatility in the kinds of code that you are able to work with. 

Python is easily available, for free, and it will help to simplify the process of finding a solution or creating a program because you won’t have to do a lot of nonsense you would otherwise. In addition to being easy to read and write, one of the biggest advantages of using the Python language is that you are able to run it on any computer system that you want. You don’t need to go out and get a new operating system, but if you are still looking for some options, consider going with Linux because Python is designed to work the best with this one, and it is already installed on Linux.

When Python was first developed during the Nineties, a team of volunteers ran the project. This is an open source project though which makes it easier for other programmers to get ahold of the Python base code and make adjustments as needed. This is why there are several versions of Python available. As issues arise with one of the versions or new developments occur, programmers are able to get ahold of the code and make updates and changes so you always have the very best and you can choose the version of Python that you would like to use.

While Python is considered a language for beginners, there are actually quite a few uses for it. Many of the websites that you find online will use Python code and sites like Google and YouTube were even created with some Python code. These are just a few of the many websites online that have been used with Python code from the government to business sites and so much more.

There are many benefits to choosing to go with the Python programming language compared to one of the others. Beginners like that this is an easy one to work with, a language that they can pick up on really quickly – and since it is based on the English language, they aren’t going to be stuck trying to figure out what some of the words mean. 

Many people choose to use the Python programming language as their beginning language, and you may become so familiar with how this language works that there will be no want to learn any of the others. Python is really simple and even beginners are able to catch on to the syntax when working on some of the code. 

The Python project code is also a free and open source. You will not have to spend any money to get Python downloaded unless you choose to pick out an IDLE that will cost some money to get more features, but there are free versions of most IDLEs as well IDLE stands for Integrated Development and Learning Environment and it is integrated into the default Python package as well as some of the Linux distributions that use Python. In terms of Python being open source, this basically means that anyone can get the code and make improvements and changes, which is why there are so many great versions of Python on the market. You will be able to pick out which version of Python you would like to work with based on what you would like the program to do for you. Most people tend to use Python 2 or Python 3, depending on what is required of but it is worth bearing in mind that Python 3 is NOT an update to Python 2, rather it is a separate program and is not truly backward compatible. Therefore, trying to use Python 3 with a Python 2-based program will likely result in errors.

As a beginner, you will also appreciate that there is a really large community of support for Python.

Python is one of the most popular coding languages, which means that there are people all over the world who choose to use this language for their needs. Because of this, you can easily go online and find answers to your questions, tutorials, and other information to help make your coding so much easier. This programming language is able to combine with some of the other coding languages if you would like to do this. Python does not have the power to do everything, but when it combines with other programs, this issue can be fixed. It is possible to add together the Python programming language with some other coding languages, such as C++ and JavaScript, in order to get some of the other stuff that you would like done finished.

While there are many things that you are going to love about Python, it is important to understand that it is a beginner language, so some of the more complex things that you would like to do with this language may not be possible. But as a beginner, you probably won’t be able to get to these options right at the start anyway and you can at least use Python as a stepping stone to learning one of the other languages. There are still many other things that you are able to do with Python so you should be able to create some of the programs that you want. 

Overall, for a beginner, Python is one of the best coding languages to work with. It has a simple syntax that you will catch on to quickly and it isn’t hard to put this to work for you.


Working with Python:

Once you decide that it is time to work with the Python language, it is time to get the interpreter and download it to your computer. There are a few different versions that you are able to work with and each is going to have different features based on what you would like the program to do for you. Go and visit the website https://www.python.org/downloads so that you can see which versions are there and then pick the one that you want to download. Remember that if you are using Linux, Python will already be downloaded for you.

In addition to downloading the actual interpreter for coding, you should take the time to pick out and set up a development environment for Python. This is basically the environment that you will write your codes on and work within and without it, it is hard to get your code to work properly. There is an IDLE that is available with the Python program and you should be able to download these at the same time. Many prefer text editors to the Python IDLE. Notepad or a similar product on Mac or Linux will work just fine as the text editor, but you may wish to get another such as Atom or Sublime Text.

Once you get these few things set up, you will be ready to go through and write out some of the code that you want. Python is pretty easy to use and we will take some time to work on code for the various features of programs that you want to write, but you do need to take the time to get all the software downloaded before getting started.

How to Install Python:

Python is built into Mac OS and to Linux so only those on Windows need to install it.

1. If Python is not already on your Windows PC, open your browser and head over to the Python download page.
2. Decide which version of Python you wish to download and click on the download link. For most of this book, we will be using Python 2 so click the latest version
3. Now click the Download link on the page
4. At the bottom of that page, you will see a link for the Windows x86 MSI Installer – click on it to download it
5. Once the download has completed, locate it in your downloads and double-click the file
6. Click on Run 
7. If you are the sole user of your PC, leave the option for Install for all Users selected. If others use your PC and you don’t want Python on all their accounts, choose Install Just for Me and then click on Next
8. Choose where you want the download to go and click on Next
9. In the window, find where it says Add Python.exe to Path and click on the red x.
10. Click on the option for Will be Installed on Local Hard Drive
11. Click on Next
12. The installation will open a Command Prompt window and will install a package management tool called Pip. This is what will let you install the other Python packages that you want through PyPi – the Python Package Index
13. Once the process completes, click Finish


Add Python to the System Path Variable:

Whether you need to do this or not will depend on the Python version you are running. If you choose Python 3, you can ignore this simply because this is incorporated into the new updates. If you opted for Python 2, you will have to follow these steps:

1. Open the Start menu
2. Type in the word Environment and then click on Edit the System Environment Variables
3. A window called System Properties will appear, click Environment Variables
4. At the bottom of the window is a section for System Variables – click New to make a new Python variable
5. Type in a name for the path and then enter the following code. Call it PythonPath for now: C:\Python27\;C:\Python27\Scripts;
6. Click on OK>OK>OK and the click the red x; this will save the changes and you will come out of the window

That sets Python up on your Windows PC.

Post a Comment

Previous Post Next Post