Introduction to Python and setting up Python Development Environment
Welcome! This is your first step towards learning Python programming language. Or, Do you know this language already and are here just to revise your concepts?. It doesn't matter which category you belong to because we will be teaching you Python, right from the basics.
An experienced programmer might have an advantage of picking up topics and lessons rather quickly, even though we recommend you to not to hurry through the topics, since Python, although being a normal programming language, carries some nice treats for programmers, and you would not want to miss those in the tutorials.
For all the noobs out there, there is nothing to worry. You should be happy that you have chosen the most amazing and simple tutorial to learn Python.
Why Python?
Python is considered as one of the most versatile programming languages. If you have even a little experience in programming, then you will soon notice the difference. Let's take a look at the features of Python.
Features of Python
- It has simple easy-to-use syntax.
- It can run on almost any platform including Windows, Linux's all distros(All versions of Linux), Mac OS X, Unix etc.
- You can even combine the pieces of other programming languages like C, C++, etc with python to utilize the best of both worlds.
- It's large standard library support makes real life programming much easier.
- Other than that, it's open source, and have a huge community support working actively with Python programming.
- It's Object Oriented (also called OO Programming or OOP) which makes it more applicable to be used in real world application programming.
- Also, it can not only be used to write complex programs but can also be used to design applications with GUI(Graphical User Interface).
- Python is an Inerpreted language, as its the Interpreter which executes the python code line by line, which makes it easier to debug. But it is a topic of never ending discussion that is Python compiled? Well, technically it is, from user written code to bytecode, and the bytecode is then sent to the Interpreter to execute it. Here is a good StackOverflow discussion over this: Is Python interpreted, or compiled, or both?
- Python has numerous implementations like CPython(The Standard implementation of python), Jython(Targeted for integration with java programming language) etc.
As far as its simplicity of syntax is concerned, let's see an example code. Consider a program where you want the user to enter something from the keyboard and you want to save that value in a variable. For C++, a popular programming language, here is how you will be writing it:
#include<iostream>
using namespace std;
int main(){
int x;
cin >> x;
return 0;
}
For Core Java, another popular programming language, it will be:
import java.util.Scanner;
class Test{
Scanner input = new Scanner(System.in);
public static void main(String args[]){
int x;
x = input.nextInt();
}
}
And in
Python
, it is (*drum roll*):x = input()
No kidding. That's all it will take. No file importing, no curly braces, no semicolons and just one line. It's really not necessary to understand that code piece right now. It was just meant to demonstrate you that how Python can be a programmer's relief.
Another thing that can be noticed in above code is, in the case of C++ and Java user can only type any
integer
as the input to variable x
, because we have declared value x
as an integer by specifying the code: int x;
. In case of Python, programmers don't have to explicitly specify the data type while declaring a variable, python's compiler will do that itself, based on the type of value assigned to the variable.Few things about the course
To be precise there are currently two releases of Python that are available on their official website i.e., Python 2.x and Python 3.x. In this course we will be dealing with Python 2.x, the reason behind this is because it is ideal to learn Python 2.x first.
Python 2.x is legacy, Python 3.x is the present and future of the language
Python 2.x is what has been used in the programming world until recently when Python 3.x stable version was released. Hence, for beginners Python 2.x is more than perfect to use, because you will find plenty of resources for it on the Internet. Moreover, Python 3.x has a poor library support, as it is very new, which means we will have less options to find and use ready-made functions/libraries. Certainly, this is not suitable for a beginner, but you can shift to Python 3.x once you get a hold over Python programming. So, let's get started with Python 2.x.
Also, there is not too much difference between Python 3.x and Python 2.x, the major change is in the way how you print anything. It was just
print
in Python 2.x and in Python 3.x they made it print()
, yes added the brackets.Applications of Python
One can say, you can do almost anything with Python.
- Web Application: Python can be used to develop scalable and secure web applications. Frameworks like Django, Flask, Pyramid etc are amazing to design and develop web based applications.
- Computer Software or Desktop Applications: As python can be used to develop GUI too, hence it is a great choice for developing desktop applications.
Tk
is an open source widget toolkit which can be used to develop desktop applications with python.Kivy
is another such platform. - Scientific Computing Application: For its amazing computational power and simple syntax, python is used for scientific computing applications. Python libraries like
SciPy
andNumPy
are best suited for scientific computations. - AI and ML(Artificial Intelligence and Machine Learning): Python is at the fore front of the paradigm shift towards Artificial Intelligence and Machine Learning.
- Image Processing: Python is known for its image processing capabilities, which includes traversing and analysing any image pixel by pixel. There are numerous python libraries available for image processing, for example: Pillow, scikit-image etc.
Starting with something that you might already be using: Websites like Instagram, Reddit, Mozilla, have been developed using Python. There are various web frameworks like
Django
(most popular one) and Pyramid
, based on Python, which can be used to develop modern web applications.
--------------------------------------------------------------------------------------------
phython code for practice:
class Vector2D:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, other):
return Vector2D(self.x + other.x, self.y + other.y,self.z+other.z)
first = Vector2D(5, 7,3)
second = Vector2D(3, 9,4)
third = Vector2D(5,6,8)
result = first + second + third
print(result.x)
print(result.y)
print(result.z)
===================================================================================================
=================================================================================
Find the Smallest Divisor of an Integer
Check if a Number is a Palindrome
Take the Temperature in Celcius and convert it to Farenheit
Reverse a Given Number
Nice blog. You have provided such a useful information in this blog. Thanks for sharing.
ReplyDeleteDevOps Training
DevOps Online Training
I am really happy with your blog because your article is very unique and powerful for new information.Thanks for sharing this wonderful content.
ReplyDeleteDevOps Training in Chennai
DevOps Online Training in Chennai
DevOps Training in Bangalore
DevOps Training in Hyderabad
DevOps Training in Coimbatore
DevOps Training
DevOps Online Training
Excellent Blog! I would Thanks for sharing this wonderful content.its very useful to us.I gained many unknown information, the way you have clearly explained is really fantastic.
ReplyDeleteFull Stack Training in Chennai | Certification | Online Training Course
Full Stack Training in Bangalore | Certification | Online Training Course
Full Stack Training in Hyderabad | Certification | Online Training Course
Full Stack Developer Training in Chennai | Mean Stack Developer Training in Chennai
Full Stack Training
Full Stack Online Training
Great post, thanks for sharing the nice inforamtion.
ReplyDeletePython Online Training
Python Online Training in Chennai
Python Online Course in Chennai
Superb post.
ReplyDeletealso, check Python course in Pune