GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • C programming
  • C++ programming
  • Java programming
  • Python programming
  • HTML
  • CSS
  • Codenora IDE (opens in a new tab)
  • About us
  • Pricing
  • Contact us
  • Privacy policy
  • Terms of service
  • Refund and Cancellation

This view

  • Original page
  • New address

GeezerVison is showing www.dremendo.com — Data Types in Python Programming Language | Dremendo

  • Dremendo
  • C
  • C++
  • Java
  • Python
  • HTML
  • CSS
  • More
    • Home
    • C Tutorial
    • C++ Tutorial
    • Java Tutorial
    • Python Tutorial
    • HTML Tutorial
    • CSS Tutorial
?>
profile image
Announcements
No new announcements.
mentora icon
Python Programming Tutorial
  • Python Basic Concepts
    • Introduction
    • Variable
    • Data Types
    • Naming Conventions
    • Typecasting
  • Operators in Python
    • Operators
    • Assignment Operators
    • Arithmetic Operators
    • Relational Operators
    • Logical Operators
    • Identity Operators
    • Membership Operators
    • Operator Precedence
  • Input and Output in Python
    • Environment Setup
    • print() Function
    • input() Function
    • Comments
  • Decision Making in Python
    • Decision Making
    • if Statement
    • if else Statement
    • if elif Statement
  • Mathematical Functions
    • Mathematical Functions
  • Loops in Python
    • Loops
    • for Loop
    • while Loop
  • String in Python
    • String
    • String Methods
  • Built-in Data Structures in Python
    • Lists
    • Tuples
    • Sets
    • Dictionaries
  • Arrays in Python
    • Arrays
  • Searching in Python
    • Linear Search
    • Binary Search
  • Sorting in Python
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
  • Function in Python
    • Function
    • Recursive Function
    • Lambda Function
    • Closures
    • Decorators
    • Generators
  • OOPs in Python
    • Classes and Objects
    • Instance Variables
    • Instance Methods
    • Class Variables
    • Static Methods
    • Inheritance
    • Types of Inheritance
    • MRO
    • Polymorphism
    • Abstract Classes
  • User-Defined Data Structures in Python
    • Stack
    • Queue
    • Circular Queue
    • Double Ended Queue
    • Singly Linked List
    • Doubly Linked List
    • Stack using Linked List
    • Queue using Linked List
  • Modules in Python
    • Modules
    • Time Module
    • Datetime Module
    • OS Module
    • Shutil Module
    • Sys Module
    • JSON Module
    • Random Module
  • Regular Expression in Python
    • Regular Expression
  • Exceptions in Python
    • Exception Handling
  • File Handling in Python
    • Text File Handling
    • Binary File Handling
    • CSV File Handling

bookmark
Table of Contents

    Data Types in Python Programming Language

    In this lesson, we will learn about the Data Types in the Python programming language along with a quiz on it.

    What is Data Type

    In Python, a data type classifies the kind of value stored in a variable. Python is dynamically typed, meaning the type of a variable is determined at runtime based on the assigned value. Memory management is handled automatically through reference counting and garbage collection. Python supports the following data types:

    data types in python programming language
    Video Explanation

    Click the button below to watch the explanation.

    Please wait while the video is loading....
    video image

    Integer

    The integer data type (represented as int) is used to represent whole numbers, which can be positive, negative, or zero. Unlike some other programming languages, Python's integer type has no size limit, meaning it can handle very large values, as long as you have enough memory.

    Example: 56, 8, 91, 436, etc.

    Float

    The float data type (represented as float) is used to represent floating-point numbers, which are numbers that contain a decimal point. Floats can represent both positive and negative numbers, including fractions and very small or large values.

    Example: 2.3, 18.12, 294.0 etc.

    Complex Number

    A complex number data type (represented as complex) is a number that has both a real part and an imaginary part. Python requires j (lowercase) for imaginary parts. Complex numbers are commonly used in fields like engineering, physics, and computer science, particularly in applications involving signal processing, control systems, and quantum mechanics.

    Example: 9 + 21j, -3 - 9j, -72 + 81j, etc.

    Boolean

    The boolean data type (represented as bool) is used to represent logical values, which can be either True or False. This data type is essential for making decisions in programming, allowing you to control the flow of your code based on certain conditions.

    String

    The string data type (represented as str) is used to represent sequences of characters. Strings can include letters, numbers, symbols, and whitespace. They are one of the most commonly used data types for handling textual data. Strings can be defined using single quotes ('), double quotes ("), or triple quotes (''' or """) for multi-line strings.

    Example: 'hello', "Python", "4586", "56$", " Programming ", etc.

    List

    The list data type is used to store an ordered collection of items. Lists can hold items of different data types, including other lists, and are mutable, meaning their contents can be changed after creation. Lists are defined using square brackets [ ]

    Example: ["apple", "banana", "cherry"], [1, 2, 3, 'apple', 4.5].

    Tuple

    The tuple data type is used to store an ordered collection of items. Unlike lists, tuples are immutable, meaning once they are created, their contents cannot be changed. This property makes tuples useful for representing fixed collections of items. Tuples are defined using parenthesis ( )

    Example: (15, "Albert", 18.20)

    Dictionary

    A dictionary is an unordered collection of key-value pairs, where each key is unique and is used to access its corresponding value. Dictionaries are defined using curly braces { } and allow for fast retrieval of values based on their keys.

    Example: {"name" : "frankie" , "age" : 18}

    Set

    A set is an unordered collection of unique elements, meaning it cannot contain duplicate items.

    Example: {"a", "b", "c"}

    In the upcoming lessons, we will explore all the data types in detail and discuss their uses.

    Test Your Knowledge

    Attempt the questions in the exercise to check whether you have understood the lesson clearly.

    Exercise
    Test Your Knowledge
    Previous Next

    We care about your privacy

    Dremendo uses cookies and similar technologies that are necessary for the site to work properly, understand how you interact with our website, and measure the effectiveness of our marketing. By clicking Accept All, you consent to the use of non-essential cookies and similar technologies for analytics, advertising, and ad measurement, as described in our Privacy Policy.

    Cookie Preferences

    Choose which types of cookies Dremendo may use.

    Necessary Cookies

    Required for essential website functionality and security.

    Allow
    Analytics Cookies

    Help us understand how visitors use Dremendo.

    Allow
    Marketing Cookies

    Help us measure advertising performance and understand interactions with our advertisements.

    Allow
    Mentora Question Asked: 0 / 20

    Hi, I’m Mentora!

    I’m your personal AI tutor from Dremendo. Ask me anything, and I’ll help you understand it in a simple and easy way.

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.