filmov
tv
What are Data Types in Python | EP-7 Data Types in Python | All Python Data Types | Python Tutorials

Показать описание
# Datatypes
Python Data types are the classification or categorization of data items. It represents the kind of value that tells
what operations can be performed on a particular data. Since everything is an object in Python programming,
Python data types are classes and variables are instances (objects) of these classes. The following are the standard or
built-in data types in Python:
Numeric
Sequence Type
Boolean
Dictionary
"Numeric data type"
"""This value is represented by int class.
It contains positive or negative whole numbers
(without fractions or decimals). In Python, there is no
limit to how long an integer value can be"""
num = 10
print(type(num))
""".This value is represented by the float class.
It is a real number with a floating-point representation.
It is specified by a decimal point."""
var =7.8
print(type(var))
""" A complex number is represented by a complex class.
It is specified as (real part) + (imaginary part)j. For example – 2+3j"""
number = 5+9j
print(type(number))
"Sequence Data Types in Python"
#1.String
""" A string is a collection of one or more characters put in a
single quote, double-quote, or triple-quote.
In Python, there is no character data type Python, a character
is a string of length one. It is represented by str class."""
Company = "cybrosys"
print(type(Company))
#2.List
"""Lists are just like arrays, declared in other languages
which is an ordered collection of data.
It is very flexible as the items in a list do not need to be of
the same type."""
list = ['a',1,2]
print(type(list))
#3.Tuple
"""Just like a list, a tuple is also an ordered collection of
Python objects. The only difference between a tuple and a list
is that tuples are immutable i.e. tuples cannot be modified
after it is created. It is represented by a tuple class. """
t=("w","i","o")
print(type(t))
"Boolean Data Type in Python"
#boolean(True/False)
""" Boolean objects that are equal to True are truthy (true),
and those equal to False are falsy (false).
However non-Boolean objects can be evaluated in a Boolean context
as well and determined to be true or false.
It is denoted by the class bool.
Note – True and False with capital ‘T’ and ‘F’ are valid
booleans otherwise python will throw an error. """
a=10
b=20
result = a+b
r = a less than b
c= a greater than result
print(type(result),result)
print(type(r),r)
print(type(c),c)
"Dictionary Data Type in Python"
"""A dictionary is an ordered collection of data values,
used to store data values like a map, Dictionary holds a
key: value pair.Each key-value pair in a Dictionary is separated by a colon : ,
whereas each key is separated by a ‘comma’."""
dictionary ={
"company":"cybrosys",
"venu":"kinfra"
}
print(type(dictionary))
#python #pythonforbeginners #datastructures #datatypes #programming #coding #tutorial #pythonprogramming #learnpython #beginnerprogramming #episode7 #crashcourse #programmingcourse #PythonDataTypes #PythonTutorial #DataTypesInPython #CodingForBeginners #PythonCourse #PythonCoding #TechEducation #freepythoncourse #freepythonvideos #freepythontutorials
Connect With Us:
—————————————
Python Data types are the classification or categorization of data items. It represents the kind of value that tells
what operations can be performed on a particular data. Since everything is an object in Python programming,
Python data types are classes and variables are instances (objects) of these classes. The following are the standard or
built-in data types in Python:
Numeric
Sequence Type
Boolean
Dictionary
"Numeric data type"
"""This value is represented by int class.
It contains positive or negative whole numbers
(without fractions or decimals). In Python, there is no
limit to how long an integer value can be"""
num = 10
print(type(num))
""".This value is represented by the float class.
It is a real number with a floating-point representation.
It is specified by a decimal point."""
var =7.8
print(type(var))
""" A complex number is represented by a complex class.
It is specified as (real part) + (imaginary part)j. For example – 2+3j"""
number = 5+9j
print(type(number))
"Sequence Data Types in Python"
#1.String
""" A string is a collection of one or more characters put in a
single quote, double-quote, or triple-quote.
In Python, there is no character data type Python, a character
is a string of length one. It is represented by str class."""
Company = "cybrosys"
print(type(Company))
#2.List
"""Lists are just like arrays, declared in other languages
which is an ordered collection of data.
It is very flexible as the items in a list do not need to be of
the same type."""
list = ['a',1,2]
print(type(list))
#3.Tuple
"""Just like a list, a tuple is also an ordered collection of
Python objects. The only difference between a tuple and a list
is that tuples are immutable i.e. tuples cannot be modified
after it is created. It is represented by a tuple class. """
t=("w","i","o")
print(type(t))
"Boolean Data Type in Python"
#boolean(True/False)
""" Boolean objects that are equal to True are truthy (true),
and those equal to False are falsy (false).
However non-Boolean objects can be evaluated in a Boolean context
as well and determined to be true or false.
It is denoted by the class bool.
Note – True and False with capital ‘T’ and ‘F’ are valid
booleans otherwise python will throw an error. """
a=10
b=20
result = a+b
r = a less than b
c= a greater than result
print(type(result),result)
print(type(r),r)
print(type(c),c)
"Dictionary Data Type in Python"
"""A dictionary is an ordered collection of data values,
used to store data values like a map, Dictionary holds a
key: value pair.Each key-value pair in a Dictionary is separated by a colon : ,
whereas each key is separated by a ‘comma’."""
dictionary ={
"company":"cybrosys",
"venu":"kinfra"
}
print(type(dictionary))
#python #pythonforbeginners #datastructures #datatypes #programming #coding #tutorial #pythonprogramming #learnpython #beginnerprogramming #episode7 #crashcourse #programmingcourse #PythonDataTypes #PythonTutorial #DataTypesInPython #CodingForBeginners #PythonCourse #PythonCoding #TechEducation #freepythoncourse #freepythonvideos #freepythontutorials
Connect With Us:
—————————————