In this blog, we will be learning the steps to be followed to understand essenstials concepts of the python language and will be able to develop an application on python. This blog is mainly for the newbies who want to become proficient in python. So, lets get started.
Unlike video tutorials, To gain most benefit out of this blog tutorials you need to be interactive and need to follow the guidelines and code along with the blog. In other words its a kind of hands on approach.
Firstly you need to know the some of the basic terminologies to understand.
Terminologies to know:
The below terminologies you need to know before getting started with tutorials. This are very basic stuff you can easiy get an overview of this by googling.
- machine code
We will start by downloading python and install it.
Python Environment setup and IDE
For learning python you need a environment to run the python code. Environment?? yeah it means you need a program that understand python code. In simple term, Install python on PC,
Step-1: For installing python go to python.org and download python 3 for your os and install it. After installation just run below code in cmd
This command run the python program and give the version of the python installed on the PC.
It should show you the version of the python on cmd console.
C:\> C:\Python35\python Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 22:15:05) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
if setup is not done properly then it will show this
C:\Users\user>python --version 'python' is not recognized as an internal or external command, operable program or batch file.
The above output says that it is not able to find any application as python in the environment path variable. It will be fixed if you set environment path variable for python.
Step-2: Download a Integrated Development Tool (IDE), tool used write a code easily and efficiently. For python i recommend pycharm, Actually you can write code even in notepad but is very uncomfortable and inefficeint.So we as developers always use a good IDE to boost our productivity.
Okay, so browse and download the pycharm ide community edition as its free.
Step-3*: Create a python file, Python file?? yeah any file with '.py' as its extention is a python file. Okay then lets create it know. Create a new text file and change its extention from '.txt' to '.py'. Or you can
either create it using notepad i.e, create any file in notepad and save with
.py extension. or Open pycharm and create python file from the
Hurray! you have created a python file.
Writing the first python program .
Write the below code into the new python file and save file.
And Run the python file in cmd by excuting the command as
python newfile.py . The command syntax is 'python' keyword followed by the path of the python file to excute. In below example the file is store in desktop so path is as follows 'desktop/newfile.py'
C:\Users\Masi>python desktop/newfile.py hello world C:\Users\Masi>
below image gives you idea about how to run the python file.
* this will only excute when the path is set for pyhton in environment variable.If not showing following output set environment variable first. 😃
C:\Users\Masi>python Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
When we write
python in command line its start a python Interpreter ( software which reads the python code and follow the instructions ) and following that keyword when we write anything other than python commands like
--help,--verion,etc it consider it to a path of the python file (
.py) . as in below something is not a valid file (path and name of file) it throws error.
C:\Users\Masi>python something python: can't open file 'something': [Errno 2] No such file or directory C:\Users\Masi>
As the above work have consume a lot of time in creating file and excuting it. For pycharm this whole work is done in no time with and great ease. Therefore, Just used the pycharm ide. create file in pycharm, add the code and press the run button to excute it ( its looks like play button ) or right click the file and click the run python file.
Its shows the output of the program in a console open in pycharm.
C:\Users\Masi\AppData\Local\Programs\Python\Python38-32\python.exe "C:/Users/Masi/Desktop/python tutorials/heloworld.py" hello world Process finished with exit code 0
Also advantage of using ide like pycharm is to avoid syntax error which are real pain.
In above we have seen a code as
print('hello world'). Here print is a build-in function ?? yeah build-in function, A code or funtion which has some task to do which is available to us by python application.
So, print() is built-in function when used need to print the value given to it in between the brackets
() to the console.Here the value given was 'hello world' so it printed the value hello world on console. If we give it value
1000 it print
1000 to the console. Try it out.
C:\Users\Masi>python Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print(1000) 1000 >>>
You can try it with diffent input. You can only learn if you play around with this more. spend some time on this and try with diffirent types of input. If its throw error then dont panic. Read the error message carefully. Its gives you the reason for the error. If not able to fix. Copy the code on google and search to debug it.
For Pycharm if you are unable excute or run the python file just click this link for details.Click me
cmd output for print:
print("Hello World!") print("Hello Again","I like typing this.") print("This is fun.",'Yay! Printing.', "printing again and again",' this is great ')
Here the print() is taking more than one values like more than one statements.
Hello World! Hello Again I like typing this. This is fun. Yay! Printing. printing again and again this is great
print(5, 6, 'this are the values') print(5+6, 5-6, 5*6, 5/6) print('what is the number',8+6) print('5+6') print("i am using double quotes")
5 6 this are the values 11 -1 30 0.8333333333333334 what is the number 14 5+6 i am using double quotes
Here if you observe first the program excute the operation between numbers i.e, addition of 5 + 6 then it value is being replace by the expression. for example, the value of 5+6 is 11 so the value is being replace by the expression.
Note: the expression is not in between the quotes i.e,
'' so the expression is solve in this case addition then its value is replace to the expression. If you write the expression in quotes then the expression is printed.
There are many more topics to learn. lets list out what we are going to learn.
As there are many topics to learn which cannot be done in single blog, so we have created seperate blogs for different topics you can click the topics to explore the more.
- varables and datatypes (click on link to know about variables and datatypes)
- List and Tuples
- Dictionary and sets
- Loops and conditional statements
- functions and lamda
- File handling
Go through the above tutorials and you will able to code the basic program like calculator, Password Generator, Guess The Number. String Modifier.
After this you need to know about the following concepts which are required to call your-self python developer.
Intermediate and Advance topics
- Unicode and Byte string
- OOPS concepts.
- Working with Api
- Web Application
* the blogs constantly update to provide quality content if some of link dosn't work dont worry we will surely update it as soon as possible.