Close Menu
    Facebook X (Twitter) Instagram
    Oixiesoft
    • Home
    • Services
      • WordPress Malware Removal
      • Fix WordPress Errors
      • WordPress Website Development
    • Articles
    • Contact
    Oixiesoft
    Home»Tutorial»Python»Python Tuples
    Python

    Python Tuples

    Editorial StaffBy Editorial StaffNo Comments1 Min Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Introduction to Tuples in Python

    Tuples are a built-in data type in Python that is used to store a collection of values. Like lists, tuples can contain any type of data, including numbers, strings, and other objects. However, unlike lists, tuples are immutable, meaning that their values cannot be changed once they are created. Tuples are often used to group related values together, or to return multiple values from a function.

    Creating a Tuple

    A tuple can be created by enclosing a sequence of values in parentheses. For example:

    my_tuple = (1, 2, 3)
    

    This creates a tuple with the values 1, 2, and 3. Alternatively, a tuple can also be created without using parentheses, by separating the values with commas:

    my_tuple = 1, 2, 3
    

    This also creates a tuple with the values 1, 2, and 3.

    Accessing Tuple Values

    Tuple values can be accessed using indexing, just like with lists. The first value in a tuple has an index of 0, the second value has an index of 1, and so on. For example:

    my_tuple = (1, 2, 3)
    print(my_tuple[0])  # Output: 1
    
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Editorial Staff

    Related Posts

    CodeIgniter vs Laravel: A Detailed Side-by-Side Comparison

    Python Arrays

    Python Lambda

    • Python Introduction
    • Python Home
    • Python Keywords and Identifiers
    • Python Variables & Constants
    • Python Operators
    • Python Booleans
    • Python Lists
    • Python Tuples
    • Python Sets
    • Python if…else Statement
    • Python Loops
    • Python Functions
    • Python Lambda
    • Python Arrays
    Services
    • Web Development
    • Mobile Application Development
    • WordPress Malware Removal Service
    • Website Design
    • WordPress Development
    • Magento Development
    • Shopify Development
    • SEO Services
    Blog
    • How to Fix the Error Establishing a Database Connection
    • Ping List WordPress
    • How To Fix Japanese Keyword Hack
    • How to remove Malware from WordPress
    Hire Developers
    • Hire WordPress Developer
    • Hire Shopify Developer
    Contact Info
    • Oixiesoft Technologies
      A-40, Block A, I thum Tower, Sector 62, Noida
    • [email protected]
    • Privacy Policy
    • About Us
    • Contact Us
    © 2025 OixieSoft Technologies

    Type above and press Enter to search. Press Esc to cancel.