(Sponsors) Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!
Getting started with python:
What is Python:
Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best. With python you can do everything from GUI development, Web application, System administration tasks, Financial calculation, Data Analysis, Visualization and list goes on.
Python is interpreted language
Yes, python is interpreted language, when you run python program an interpreter will parse python program line by line basis, as compared to compiled languages like C or C++, where compiler first compiles the program and then start running.
Now you may ask, so what’s the difference ??
Difference is that interpreted languages are little bit slow as compared to compiled languages. Yes, you will definitely get some performance benefits if you write your code in compiled languages like C or C++.
But writing codes in such languages is a daunting task for beginner. Also in such languages you need to write even most basic functions like calculate the length of the array, split the string etc. For more advanced tasks sometimes you need to create your own data structures to encapsulate data in the program. So in C/C++ before you actually start solving your business problem you need to take care of all minor details. This is where python comes, in python you don’t need to define any data structure, no need to define small utility functions because python has everything to get you started.
Moreover python has hundreds of libraries available at https://pypi.python.org/ which you can use in your project without reinventing the wheel.
Python is Dynamically Typed
In python you don’t need to define variable data type ahead of time, python automatically guesses the data type of the variable based on the type of value it contains.
For e.g
1 | myvar = "Hello Python" |
In the above line "Hello Python" is assigned to myvar , so the type of myvar is string.
Note that in python you do not need to end a statement with a semicolon ( ; ) .
Suppose little bit later in the program we assign myvar a value of 1 i.e
1 | myvar = 1 |
now myvar is of type int .
Python is strongly typed
If you have programmed in php or javascript. You may have noticed that they both convert data of one data type to other data type automatically.
For e.g:
in JavaScript
1 | 1 + "2" |
will be '12'
here 1 will be converted to string and concatenated to "2" , which results in '12'
, which is a string. In Python automatic conversions are not allowed, so
1 | 1 + "2" |
will produce an error.
Write less code and do more
Python codes are usually 1/3 or 1/5 of the java code. It means we can write less code in Python to achieve the same thing as in Java.
In python to read a file you only need 2 lines:
1 2 | with open("myfile.txt") as f: print(f.read()) |
Who uses python:
Python is used by many large organization like Google, NASA, Quora, HortonWorks and many others.
Okay what i can start building in python ?
Pretty much anything you want. For e.g
- GUI application.
- Create Websites.
- Scrape data from website.
- Analyse Data.
- System Administration Task.
- Game Development.
and many more …
In the next post we will learn how to Install python.
Other Tutorials (Sponsors)
This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!
how do I create my game on phython
you need pygame to create games in python. I will post tutorials about it soon.
ok cool
Python seems ridiculously easy compared to C# which is my first and most fluent language. But I do have a question, which do you believe is more powerful?
Yes python is very easy as compared to c#. Both are equally powerful, it really depends on your needs what you need to accomplish.
I aspire to work in InfoSec and I know that there’s a lot of work required to get there. Just to express my dedication, I’m currently taking a degree in Networks and Security.
I hear Python is often the choice of language often used by many in the InfoSec field, but it just seems it’s not complex enough to be able to accomplish the tasks required, such as breaching a network. I was expecting this to be on a similar level to C or C++. Python, to me almost seems like an advanced script language comparing it to the likes of Bash or a Windows batch script.
This was exactly i though when i started learning python, 3 years ago, C was my first language. When i started leaning about python seems to easy to accomplish real world tasks. But i was wrong. Python is used world wide because of it”s simplicity. Quora is written in python, Mozilla, bitbucket, even google uses python.
Python has extensive set of libraries that can accomplish any real world task. So don’t get carried away because it’s simplicity.
As I read that Kivy would be more indicated to create games. Is true? Do you intend to create a tutorial about Kivy? Thanks.
No kivy is targeted toward any kind multi-touch cross applications
Hi,
I just started to learn Python. Can you tell me please how do to the graph of a function like f(t,y) = t*2 + y*2.
My question is how to use python to design the graph of a function in 2 or 3 dimensions.
Thanks in advance
matplotlib is the library used to plot graphs
Can i use Python in Web based data analysis which is build in php?
Yes why not. Just process your data in the backend using python scripts.
Am a total notive but i have passion for programming and want to learn. Please, can Python be used to write AI (Artificial Intelligent) codes?
for AI you can use scikit module
Hello Team,
are there any classes available in Deli/noida for learning end to end python.
regards
Amit
9582682882
Just because of rich availability of library in Python and it is interpreted language which make its performance slow with others programming language despite why Python is most popular now a days?
A well optimized Python program can run fast as a C program. More than that compiler employs various tricks behind the scenes to make the program fast.
hey,
am started to learn Python as a beginer, can you suggest from where can i start ?
i am a beginner and i need a book to download
any link ?
plez tell me to run the first program in python
see this link https://thepythonguru.com/installing-python3/
thinks