DATA TYPES IN PYTHON

 Data types in python




        String
        Integer
        Float
        Complex
        List
        Tuple
        Range
        Dictionary
        Set 
        Boolean


String:

                strings are using single quotation, double quotation and three quotation.

Example:
#string
x="codeco"
print(type(x))
Output :
<class 'str'>

Integer:

                Integer is a numeric type

Example:
#integer
x=232323
print(type(x))
Output:
<class 'int'>

Float:
            It is similar to integer datatype but with decimal values.

Example:
#float
x=23.0000
print(type(x))
Output:

Complex:

            The first parameter is called a real and second as imaginary parts.

Example:
#complex
x=2+23j
print(type(x))
Output:
<class 'complex'>

List:

            list is a collation of any types like integer, float, string etc.. ,A list is a sequence of elements enclosed in a square brackets []

Example:
#list
x=["codeco","python","mysql"]
print(type(x))
Output:
<class 'list'>

Tuple:

            Tuple is an unchangeable, A tuple is a sequence of elements enclosed in a parentheses()

Example:
#tuple
x=("codeco","python","mysql")
print(type(x))
Output:
<class 'tuple'>

Range:

            range() fucation is a sequence of numbers ,strings

Example:
#range
x=range(23)
print(type(x))
Output:
<class 'range'>

Dictionary:

            Its doesn't allow duplicate element and it contains a key and key's value. The element enclosed curly brackets{}

Example:
#dict
x={"name":"antrow","blog":"codeco"}
print(type(x))
Output:
<class 'dict'>Booleans are the operators in python which gives the output as True or False

Set:

           Set are stored multiple items in a single variable,once a set is created you cannot change its items, but you add new items.

Example:
#set
x={"codeco","python","mysql"}
print(type(x))
Output:
<class 'set'>
Boolean;

          Booleans are the operators in which gives the output as True or False.

Example:
#bool
x=True or False
print(type(x))
Output:
<class 'bool'>
            



Comments

Popular posts from this blog

Python if....elif....else statements

What is InnoDB - Why InnoDB use - ACID properties

Inheritance-Object Oriented Programming (OOPs) concept in python