Welcome to Python Tutorial for Beginners. You are probably here because you think programming is cool. But what makes it cooler? A great programming language, right? Well there are many a language available for coding purpose. But if you are looking for that super cool programming language – Python is the one.
Python Tutorial for Beginners
Python is a high level programming language which is widely used now-a-days all over the world. It’s very easy to use and adopt. It’s a general purpose language created by Guido van Rossum. For more information see this.
In this series of Python tutorials we are going to explore the world of Python. So get ready and #happy_coding 🙂
Python Benefits
Well first let’s see what Python has to offer us – from many beneficiaries here’s a few to motivate you.
- Python is open source
- Syntax of python is easy to learn and also has high readability.
- Python has extensive support libraries.
- Python is very user friendly and has very rich built-in data structures which are easy to use. Also Python provides the option of dynamic high-level data typing which reduces the length of support code that is needed.
- The object oriented design of Python is clean which provides enhanced process control.
Concisely and most importantly Python is the language of the smartest programmers.
Application of Python
So let’s see some applications of Python in real life to give you a bit more impulse to learn this amazing programming language.
- To quote many, here are few companies and institutions who use Python as their one of the main programming
language: Google, NASA, CERN, WIKIPEDIA - Social news networking site “Reddit” is entirely written in Python.
- Python scripts serve as scripting language for web applications.So if you want a web server gateway interface you can use Python
- You may hear about some famous web framework like Django, Pylons, Pyramid, TurboGears, Flask etc. All are based
on Python. - NumPy, SciPy and Matplotlib ( Modules of Python) are used in Scientific computing.
- SageMath is a mathematical software programmable in Python.
- Python has been embedded in many software products as a scripting language like- Abaqus, FreeCAD, Cinema4D,
MotionBuilder, Softimage, GIMP and so many others. - Python has been used in algorithmic trading and Artificial Intelligence.
So what else do you expect from a programming language that Python doesn’t have? To be exact nothing. That’s the beauty of Python. What do you think? 🙂
Python Installation and First Program
So far with the introductory part, hope you are interested enough to explore the domain of python programming language. Now let’s continue to the learning part. But for that you need to install Python in your machine.
Big Question: Python 2.x Vs Python 3.x : which one to use and why?
If you surf a bit you will surely face this dilemma. There are two different kind of release of Python.They are Python version 2.x( latest 2.7) and Python version 3.x ( latest 3.6 ). So which one to use and why?
Well from version numbering you can understand Python 2.x is the previous version. In Python 3.x a vast change is seen from the previous version. But this is for sure Python 3.x is far more advanced and easy to use than Python 2.x. Though still you will see a lot of references in Python 2.x. But it is wiser to go with the latest version. So in this series we will use Python 3.6.
Python install on Windows
If you are using windows you need to download Python 3.x from here.
Simply click the installer file and follow the instructions.
Here is the image for success screen.
You are all set. After this in your start menu you can see an entry named “IDLE- Python 3.x GUI-32/64 Bit”. Click and open it.
This is your platform for coding in Python called python shell.
Now click File->New File. You will see a new script created. Write the following lines there and save it.
1 2 3 |
print("hello world") |
Below image shows IDLE app in action.
Now click Run->Run module. you will see in the shell-
1 2 3 4 5 |
======================= RESTART: C:/Python34/your_program_name.py ======================= hello world <img class="alignnone wp-image-29375 size-full" src="http://all-learning.com/wp-content/uploads/2017/04/windows-setup-run-the-python.png" alt="windows-setup-run-the-python-installer-450x281" width="1200" height="628" /> |
That’s your first program in Python. Pretty neat. Right?
Python install on Ubuntu
On Ubuntu 14.04 and later Python 3.4 is installed by default. So don’t need to do anything. 🙂
So simply open gedit
or whatever text editor you are using. write the following line in it-
1 2 3 |
print("hello world") |
Now save it. And while doing it don’t forget to change the extension of the file. It will be like “your_program_name.py”
Now open terminal and run with below command.
1 2 3 |
$python3 your_program_name.py |
You will see the output will be – “hello world”. Your very first program in Python. 🙂
Python install on MAC OS X
For MAC you can download Python 3.x from here
After downloading, double click it. you can see an installer popped up.
Just follow the instructions and click on Next buttons and it will install Python on your Mac. Below is the success screen.
Now search for IDLE app. Click and open it. This is your platform for coding in Python called python shell.
Now click File->New File. You will see a new script created. Write the following line there and save it.
1 2 3 |
print("hello world") |
Below image shows IDLE app in action.
Now click Run-> Run module. you will see in the shell-
1 2 3 4 5 |
======================= RESTART: ~your_program_name.py ======================= hello world <img class="alignnone wp-image-29379 size-full" src="http://all-learning.com/wp-content/uploads/2017/04/python-idle-shell-mac3.png" alt="python-idle-shell-mac" width="1200" height="628" /> |
That’s your first program in Python. Isn’t it cool?
Python Tutorial Conclusion
Well, for the very beginner IDLE is a standard platform for coding. Though for experienced coders, many like to use different IDEs( Integrated Development Environment ). There are a lot of IDEs available. It’s a matter of perspective which one is better. But for the later part of this tutorial series we will use “Pycharm” as our IDE. But for now IDLE is enough. So sit tight and get ready for the next part.