#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

What are the basic Data types in python?
Description

To see the different kinds of data types in python.

Process

Python numbers

Integer(int).

   It stores numeric values.

Float(float).

   It stores the decimal point values.

Python strings

Single quoted.

   String is set of characters represented in single quotation.

Double quoted.

   String is set of characters represented in single quotation.

Python Lists.

   List is a collection of elements,which is ordered and changeable.

   Python lists are written with square brackets[].

Python Tuples.

   Tuples is a collection of elements,which is ordered and unchangeable.

   Python tuples are written with round brackets.()

Python set.

   Set is a collection which is unordered and unindexed.

   Python sets are written with curly brackets.{}

Python Dictionary.

   It used to store key:value pair of data.

   Key may be a string

Sapmle Code

#integer type

salary=10000

#float type

rating=5.4

#single quoted string

string1=’sathish’

#double quoted string

string2=”kumar”

#python list

list1=[‘sathish’,’sangeetha’,’venkat’,’sheela

‘,’sudhakar’,23,24,25,22,21]

#python tuple

tuple1=(‘sathish’,’sangeetha’,’venkat’,

‘sheela’,’sudhakar’,

23,24,25,22,21)

#python set

set1={‘sathish’,’sangeetha’,’venkat’,

‘sheela’,’sudhakar’,23,24,25,22,21}

#python dictionary

dict1={‘sathish’:23,’sangeetha’:22,

‘venkat’:24,’sheela’:26,’sudhakar’:25}

#print the types of data types.

print(type(salary))

print(type(rating))

print(type(string1))

print(type(string2))

print(type(list1))

print(type(tuple1))

print(type(set1))

print(type(dict1))

Screenshots