DAY-1
Simple and easy to understand
Python is super fast
Python is platform independent, it makes de bugging easier
Python provides a very big library support
It is possible to integrate other programming languages within python
What are its uses
Data visualisation to create plots and graphic representations
Python helps in data analytics - analyze and understand raw data
It is used in AI and machine learning to simulate human behaviour and to learn from
past data without hard coding
It is also used to create web applications
It can be used to handle databases
Python extensively used in businesses and accounting to perform complex mathematical
operations along with qualitative and quantitative analysis
Modules:
Modules are used to borrow someone else’s codes which means that we can use someone
else’s codes in our own program with the help of modules
Modules are of two types
1) Built in modules
2) External modules
PIP
Pip is package installer for python. It installs whatever modules you ask from the
internet and saves it in your python interpreter
Function - in python is used to perform any task
print() is a function
*) to run any function you must and should invoke parenthesis
Print():-
When we use the print function in python we have to add a valid object (anything that
has a value). Words are not objects, they are strings and therefore we use quotations to
convert them into objects.
We use single quotations and double quotations
Single quotations are used to print single characters (a, b, c, etc.) and we use Double
quotations to print words, phrases and sentences
We use triple quotations to print multiple lines
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
To write a comment just add a ‘#’ at each line
Multiline comments
Add a # at the start of each comment
ctrl+/
Escape sequence characters:
To insert a character that cannot be directly used in a string, we use an escape sequence
character
An escape sequence character is a backslash(only backslashes) (“\”)
Example of escape sequence characters are using double quotes inside double quotes
print(“i said, \”hello\” “)
\n - newline(inserts a linebreak)
\t - tab(it gives us whitespace)
\\ - inserts backslash
\’ - single quote
\” - double quote
More on print statement:
The syntax of print statement
print(object(s), *sep=seperator, *end=end,*file=file,*flush=flush)
Object- any object and as many as you like will be converted into strings and objects
before being printed
sep=seperator: specify how to separate the objects(if there are multiple objects). Default
is ‘ ‘.
end=end: specify what to print at the end
Default is “/n”(line feed)
file=file: an object with a write method. Default is “sys.stdout”
Parameters 2 to 4 optional
Variable:
Variable is like a container that holds data.
Very similar to how our containers in the kitchen hold sugar, salt, chocos, etc.
Creating a variable is like creating a placeholder in memory and assigning some value
to it
What is a data type
1) data type specifies the type of value a variable holds. This is required in programming
to do various operations without causing an error
1) Numeric data: int(integers), float(decimal numbers), complex(complex
numbers):
Int - 3, 0, -8
Float - -0.76, 6.49, 6.00 (decimals)
Complex - (represented with ‘j’) - 8+4j
- complex(8,4)
Text data - str
Str - a , hello. My name is , python programming
Boolean data - bool
Boolean data consists true or false
Sequenced data:
1) Lists - list
2) Tuples - tuple
Mapped datas:
Dictionaries - dict
print(type(variable))