Introduction
Setup
Operators
variable
String
Number
Dtype & Comment
Lists
Tuples
Sets
Dictionaries
if else statement
For Loop
While Loop
iterator & iterable
Pre-Built functions
Function
Decorators
generators
Types of errors
Exceptions Handling
OOP
Regular expression
Create module
OS module
Date module
Random module
Math
Statistics module
Exercise 1
Exercise 2
Exercise 3
Learn Data Structure & Algorithm
Learn Numpy
Learn Pandas
Learn Matplotlib
Learn Seaborn
Learn Statistics
Learn Math
Learn MATLAB
Learn Machine learning
Learn Github
Learn OpenCV
Learn Deep Learning
Learn MySQL
Learn MongoDB
Learn Web scraping
Learn Excel
Learn Power BI
Learn Tableau
Learn Docker
Learn Hadoop
In short, data type is mentioned as data type. Data type means what kind of data we are working with. It
defines the form of the data. If we write a word then its data type is a string or if we write a number then
its data type can be integer or float or complex. In Python, the data type is always set but you can change
it. Look data type is a very important thing in coding. You must have a clear knowledge about the data type.
Because if you are not using required data type for your code then it can give you error or wrong output. So
while coding careful about data type.
Suppose you want to do addition of two numbers. To do that you are taking two numbers as input from user in
the form of string. Now if you want to do addition then you must change the data type of the given inputs from
string or text to number like integer or float. If you don't do this then you will not be able to do addition.
Because without changing the data types those inputs will be treated as string or text and we know that we
can't to subtraction, summation, multiplication, division or we can say any type of mathematical calculation
on text.
So you must use correct data type in coding otherwise it will not work or will give you an error.
There are total 6 types of data type present in python.
So the data types are:
In the example 1 we have a text in x variable. Now if we check the data type then we will see it is str means string.
Example:2In the example 2 we have a number in x variable. Now if we check the data type then we will see it is int means integer.
Example:3In the example 3 we have a number in x variable. Now if we check the data type then we will see it is float.
Example:4In the example 4 we have a list in x variable. We will learn about list in upcoming lectures. Now just think that it is data structure where you can store multiple values at a time. Now if we check the data type then we will see it is list.
Example:5In the example 4 we have a tuple in x variable. We will learn about tuple in upcoming lectures. Now just think that it is data structure where you can store multiple values at a time. Now if we check the data type then we will see it is tuple.
Example:6In the example 8 we have a dictionary in x variable. We will learn about dictionary in upcoming lectures. Now just think that it is data structure where you can store multiple values at a time in form of key and value pair. Now if we check the data type then we will see it is tuple.
When we write a lot of lines of code, sometimes we forget that why we wrote this line of code. To solve this
problem we write a short note or comment beside or under the code and it's called a comment. It doesn't effect
the code. It's just a short note.
In python we write comment by giving hash(#) or three double or single quotation(""",''').
When to use #?
If you want write a comment which is a single-line or for single line comment use hash(#).
When to use (""",''')?
If you want write a comment which is contain multiple lines or for multiple-line comments, double or single
quotations are used.
Let's see some coding example for better understanding.
Here we use comment that why I wrote this code and this is a single line comment so I use hash. This comment will not effect the code.
Example 2:Here we use comment that why I wrote this code and this is a multiple line comment so I use double quotation. You can also use single quotation. This comment will not effect the code.