Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Datatype in python programming language

Posted on October 8, 2017September 8, 2019

Table of Contents

  • Datatype in python programming language
    • Python datatype
      • Numbers
      • List in Python
      • Tuble in Python
      • String in Python
      • Hello world python
      • Hello world python
      • Hello
      •             world
      •                 python
      • Hello
      •             world
      •                 python
      • Set in Python

Datatype in python programming language

In this tutorial, we will discuss the concept of datatype in python programming language

Python datatype

Data types indicates the type of  value and how the value can be used in programs. Data type is used to allocate memory location in memory. For future use of stored data, variables are given a unique name to identify different memory locations. There is no need to declare variables before using them in python, unlike other languages. However, access to the data (content) is via variable name (variable identifiers) in python.

Datatype in python programming language
Datatype in python

Eg

your_age=34

 

Datatype in python programming language
Datatype and variable

34 is Assigned to the variable Your_age

Python has five type of data type or variable

  1. Numbers
  2. List
  3. Tuple
  4. String
  5. Set
  6. Dictionary

Numbers

  • INT – int represents negative and positive integer value without decimal point
Eg – 19,  234,  -456,  -1000
  • Float – floating point represents negative and positive values represented with decimal point.

Eg – 17.5,  234.67,  -456.4,  -1000.23

 

List in Python

List is a very important and most used data type in python. List is a collection of ordered sequence items like the array data type.

Syntax 

Syntax of list data type in Python

list_name=[Item 1,Item 2,Item 3,Item 4] ;

Example 

Names=[“mathan”,”suthan”,”babu”,”nimal”];

Tuble in Python

Tuble is a collection of ordered sequence items like List data type in Python.

Syntax 

Syntax of Tuble data type in Python

Tuble_name=(Item 1,Item 2,Item 3,Item 4);

Example 

Names=(“mathan”,”suthan”,”babu”,”nimal”);

String in Python

We can use single quotes or double code to represent a String in Python. Multi line string can be denoted using triple quotes ”’ or “””

Example 1

When the above code is executed, it produceS the following results

Hello world python

Hello world python

Hello

            world

                python

Hello

            world

                python

Program 2

when the above code is executed, it produces the following results

hello welcom
hello welcom
hello welcom
                to python
                    tutorial
hello welcom
                to python

                    tutorial

Set in Python

Set is a data type in python that is an unordered collection of stuff like list. But “set” never contains duplicates.

Syntax 

Syntax of set data type in Python

set_name={Item 1,Item 2,Item 3,Item 4} ;

Example 

Names={“mathan”,”suthan”,”babu”,”nimal”};

Dictionary in Python

Dictionary is a data type which is an unordered collection of items. A dictionary has a pair of items such as a key and a value.

 

Example

ProgrammingLanguages={}
ProgrammingLanguages[“jdk”]=”java development kit”
ProgrammingLanguages[“html”]=”Hyper text markup language”
ProgrammingLanguages[“css”]=”cascading style sheet”
ProgrammingLanguages[“xml”]=”extensible markup language”

Related post

  List in Python       

Tuple in Python                                            Dictionary in Python

Set Data type in Python

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes