Hey Guys, if you ever wanted to learn python but you don’t have any past experience then continue reading. This is the first tutorial of Python for Beginners series. In this tutorial we will cover the introduction of python following with its uses and applications. You will install and set up python on your computer and write your first program in Python.
Introduction to Python
Python is an interpreted*, high-level, object-oriented, and open-source language developed by Guido van Rossum and first released in 1991. According to a survey conducted by Stackoverflow, Python is the most sought after programming language by developers.
Compiler – It converts the source code into a machine-dependent code completely all at once.
Interpreter – Python runs and checks the code line by line. So if an error is detected at suppose line 2, then it won’t run all the way to the end of the script. Unlike Java, which compiles the whole code at once.
- Python is an interpreted language, not a compiled language. Due to this, python is easy to debug.
- Python is a cross-platform language, it can run on a variety of platforms.
- Python is open-source and free.
- Python is best for Artificial Intelligence and Machine Learning.
Installing Python is extremely easy, it’s the same as you install any other software. Just go over to the official Python Website and download the latest version or click here.
Remember to check “Add Python 3.X to PATH“. It adds PIP to environment path variables.
PIP is a Python Package installer that helps in installing libraries and modules. You will need it one day or another, so it’s better to install it now.
Selecting the Python IDE(Integrated Development Environment)
Different people suggest different IDE, it all comes down to the personal preferences.
In this series we will be using the default python idle because a large number of people use that and it is generally advised to start with that.
What I recommend is IDLE or Sublime Text. These are more than enough or you can try VS Code. Though there are many other good IDE’s but I believe an IDE should be lightweight and fast because oftentimes you have to use a web browser to search for the problems. So these 3 are the best in terms of speed and efficiency.
Out of these I recommend Sublime Text because it has a large number of color schemes which look fantastic while coding and some people prefer a darker theme which is really great in Sublime.
Working with IDLE
Writing Your First Program
After installation open up Python Shell and write this code.
print() function tells Python to print/echo whatever data is in the parenthesis.
In python, string values are written under double quotes. We will be learning more about that in the future lessons.
Congratulations, you wrote your first program in python!
As an assignment, Try printing your name in python.
Working with Files
Most beginners make this mistake of continue writing their whole program in Python Shell. You shouldn’t do it unless you want to perform a quick task.
Now in your Python Shell click on File and select New File
Now type the same code in the file and save it. The default extension of python files is .py.
After Saving the file press F5 or click on Run and select Run Module.
It should look something like this. If this is what you got then congrats, you successfully learned how to use python files.