Your Dashboard
Sign-in
Sign-up
RegularPython
  • Membership
  • RoadMaps
  • Online Tests
    • Online Test
    • Interview Questions
    • Online Store
  • Jobs
    • Student Reviews
    • Mock Interviews
    • Apply for jobs
    • Contact for help
  • Sign-in
  • Sign-up
  1. Home
  2. Python Basic Courses

regularpython@gmail.com

Image

Python Data Types

  • Category
    Regular python, Python Numbers , Strings, Lists, Tuples, Dictionaries, Sets and Boolean
  • Course Menu
    • Python Introduction
    • Python Uses
    • Python Features
    • Python Operators
    • Python Data Types
    • Python Numbers
    • Python Strings
    • Python Lists
    • Python Tuples
    • Python Dictionaries
    • Python Sets
    • Python Decision Making
    • Python Loops
    • Python Exceptions
    • Python Functions
    • Python Lambda function
    • Random Numbers in Python
    • Regular Expressions
    • Python Decorators
    • Python generators

Python Data Types

Data types are used to store data or information in a variable. Python data types are dynamic because we don’t need to mention type of the variable. But in other languages, we should mention the type of data. See the below example you can get the clarity.

Example:

In java:

            Short Age = 24

In python:

            Age = 24

Data types in python,

  • Numbers
  •  Strings
  • Lists
  • Tuples
  • Dictionaries
  • Sets
  • Booleans

 

regularpython, regular python, Data types in python, python Numbers, python strings, python lists, python tuples, python dictionaries python sets, python  booleans

Numbers:

            Number data types are used to store integers or numbers or float values of imaginary values.

Example:

            x = 10 (Integer)

            x = 10.5 (float)

            x = 10+i5 (imaginary)

Strings:

            String is nothing but a group of characters. String data types are used to store strings in a variable.

Examples:

            X = ‘regularpython.com’

            X = “regularpython.com”

            X = “““regularpython.com”””

Lists:

            Lists are used to store a sequential data types

Example:

            X = [1, 2, 3, 4, 5, 6]

            X = [‘mangoes’, ‘orange’, ‘gapes’]

            X = [1,2,3, ‘mangoes’, ‘oranges’]

Tuples:

            Tuples also used to store sequential data types. But the difference between tuple and list is,

List is mutable (we can edit, update, delete) and tuple is immutable (we can’t edit, update, delete).

Example:

            X = (1, 2, 3, 4, 5, 6)

            X = (‘mangoes’, ‘orange’, ‘gapes’)

            X = (1,2,3, ‘mangoes’, ‘oranges’)

 

Dictionaries:

            Dictionaries are used to store data in the form of a key-value pair. Dictionary is nothing but a JSON data type. In python, we called a dictionary, in other languages we called it JSON.

Example:

            X = { ‘name’:’ python’,  ‘Rank’: 1}

Sets:

            Sets are mainly used to get or store unique values only. If you want to remove duplicates then you can use sets.

Example:

            X = {1,2,3,4}

Boolean:

            Boolean data types are mainly in conditions. Boolean data types,

  Ø True

  Ø  False

Example:

            if 2==2:

                  print(‘same’)

            else:

                 print(‘Not Same’)

RegularPython

This website helps to learn ptyhon from basics to advanced level. Everything explained with some practical examples.

  • About
  • Privacy
  • Video Courses
  • Online Test
  • Python Blog

Marthahalli, Bengalore.
regularpython@gmail.com

© Copyright 2020 RegularPython.

  • Sign-in
  • Sign-up