Python progamming
Python progamming
PROGAMMING
By Rohit Kushwaha
Python is a popular programming language. It was created by Guido van Rossum, and released in
1991.
What is Programming and Python?
Programming is a way for us to tell computers what to do . The computer is a very dumb machine
and it only does what we tell it to do . Hence we learn to program and tell computers to what we
are very slow at rate - computation. If I ask you to calculate 5+6, you will immediately say 11.
How about 23453453 X 56456?
You will start searching for a calculator or jump to a new tab to calculate the same. This 100 days
of code series will help you learn Python from starting to the end. We will start from 0 and by the
time we end this course, I promise you will be a Job ready Python developer!
What is Python?
Features of Python
Python provides very big library support. Some popular libraries include NumPy,
Tensorflow, Selenium, OpenCV, etc.
Python helps in Data Analytics to analyze and understand raw data for insights and trends.
It is used in AI and Machine Learning to simulate human behavior and to learn from past
data without hard coding.
2
It can be used to work with databases.
Module is like a code library which can be used to borrow code written by somebody else
in our python program. There are two types of modules in python:
1. Built in Modules - These modules are ready to import and use and ships with the python
interpreter. there is no need to install such modules explicitly.
2. External Modules - These modules are imported from a third party file or can be installed
using a package manager like pip or conda. Since this code is written by someone else, we
can install different versions of a same module with time.
It can be used as a package manager pip to install a python module. Lets install a module
called pandas using the following command
Python Comments:
A comment is a part of the coding file that the programmer does not want to execute,
rather the programmer uses it to either explain a block of code or to avoid the execution of
a specific part of code while testing.
Single-Line comments:
Example 1
Output:
3
This is a print statement.
Example 2
Output :
Hello World ! ! !
Example 3:
Print(“Python Program”)
#print(“Python program”)
Output:
Python program
Mulit-Line Comments:
To write multi line comments you can use ‘#’ at each line or you can use the multiline
string:
4
print("p is not greater than 5.")
Output:
p is greater than 5.
To insert characters that cannot directly used in a string, we use an escape sequence
character.
An escape sequence character is a backlash \ followed by the character you want to insert.
An example of a character that cannot be directly used in a string is a double quote inside a
string that is surrounded by double quotes:
5
Other parameters of print statement
1. Object(S) : Any object , and as many as you like. Will be converted to string before
printed
2. Sep=’separator’: specify how to separate the objects. If there is more than on Default
is ‘ ‘
3. End=’end’:specify what to print at the end, Default is ‘\n’ (line feed)
4. File: An object with a write method. Defualt is sys.stdobut parameters 2 to 4 are
optional